package com.glela.goods.service.impl;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Triple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.glela.activ.model.OActivContentExpress;
import com.glela.activ.model.OActivContentMoney;
import com.glela.activ.model.OActivGiftProduct;
import com.glela.activ.model.OActivitiesInfo;
import com.glela.activ.service.OActivService;
import com.glela.cache.model.RedisKey;
import com.glela.cache.redis.RedisUtil;
import com.glela.common.constant.CommonConstants;
import com.glela.common.model.ProductTag;
import com.glela.common.util.DateUtil;
import com.glela.common.util.DateUtils;
import com.glela.common.util.NumberUtil;
import com.glela.es.model.BrandForES;
import com.glela.es.model.GoodsForES;
import com.glela.es.util.ESConstant;
import com.glela.es.util.ESUtil;
import com.glela.goods.dao.vo.LimitSaleGoodsInventroy;
import com.glela.goods.mapper.BrandMapper;
import com.glela.goods.mapper.BrandUserEnjoyMapper;
import com.glela.goods.mapper.GoodsCommentMapper;
import com.glela.goods.mapper.GoodsCommissionMapper;
import com.glela.goods.mapper.GoodsDetailMapper;
import com.glela.goods.mapper.GoodsExtendedAttributeMapper;
import com.glela.goods.mapper.GoodsMapper;
import com.glela.goods.mapper.GoodsNavigateMapper;
import com.glela.goods.mapper.GoodsSearchWordMapper;
import com.glela.goods.mapper.GoodsServicesMapper;
import com.glela.goods.mapper.HomePageStreamerMapper;
import com.glela.goods.mapper.InventoryMapper;
import com.glela.goods.mapper.LimitTimeSaleDetailMapper;
import com.glela.goods.mapper.OverseasGoodsLableMapper;
import com.glela.goods.mapper.ProductMapper;
import com.glela.goods.mapper.ShareGoodsMapper;
import com.glela.goods.mapper.StoreMapper;
import com.glela.goods.mapper.TeacherGoodsMapper;
import com.glela.goods.mapper.TeacherStreamerMapper;
import com.glela.goods.model.Brand;
import com.glela.goods.model.Goods;
import com.glela.goods.model.GoodsCommission;
import com.glela.goods.model.GoodsDetail;
import com.glela.goods.model.GoodsExtends;
import com.glela.goods.model.GoodsImgType;
import com.glela.goods.model.GoodsNavigate;
import com.glela.goods.model.GoodsPrice;
import com.glela.goods.model.GoodsSearchWord;
import com.glela.goods.model.GoodsServices;
import com.glela.goods.model.HomePageStreamer;
import com.glela.goods.model.Inventory;
import com.glela.goods.model.LimitTimeGoodsPrice;
import com.glela.goods.model.LimitTimeSaleDetail;
import com.glela.goods.model.OverseasGoodsLable;
import com.glela.goods.model.Product;
import com.glela.goods.model.SpecDesc;
import com.glela.goods.model.Store;
import com.glela.goods.model.StoreGoods;
import com.glela.goods.model.TeacherGoods;
import com.glela.goods.model.TeacherStreamer;
import com.glela.goods.model.request.GoodsRequest;
import com.glela.goods.model.vo.InventoryVo;
import com.glela.goods.model.vo.goods.BandGoodsVo;
import com.glela.goods.model.vo.goods.BrandVoResponse;
import com.glela.goods.model.vo.goods.GoodSerialVo;
import com.glela.goods.model.vo.goods.GoodsDetailResponse;
import com.glela.goods.model.vo.goods.GoodsESVo;
import com.glela.goods.model.vo.goods.GoodsListResponse;
import com.glela.goods.model.vo.goods.GoodsPageVo;
import com.glela.goods.model.vo.goods.GoodsResponse;
import com.glela.goods.model.vo.goods.GoodsServiceVo;
import com.glela.goods.model.vo.goods.GoodsSimpleVo;
import com.glela.goods.model.vo.goods.GoodsVo;
import com.glela.goods.model.vo.goods.OpenStoreGoodsVo;
import com.glela.goods.model.vo.goods.SimpleGoods;
import com.glela.goods.model.vo.goods.StreamerResponse;
import com.glela.goods.service.GoodsService;
import com.glela.goods.service.InventoryService;
import com.glela.goods.service.StoreGoodsService;
import com.glela.platform.constant.ErrorEnum;
import com.glela.platform.mapper.BaseRestrictionsMapper;
import com.glela.platform.mapper.UserInfoMapper;
import com.glela.platform.mapper.UserMapper;
import com.glela.platform.model.BaseRestrictions;
import com.glela.platform.model.User;
import com.glela.platform.model.UserInfo;
import com.glela.platform.model.request.RequestPageBaseModel;
import com.glela.platform.model.response.ResponseBaseModel;
import com.glela.platform.model.response.ResponsePageModel;
import com.glela.platform.model.response.ResponseResultModel;
import com.glela.platform.model.response.ResponseUser;
import com.glela.platform.service.BaseRestrictionsService;
import com.glela.platform.service.UserService;

@Service("goodsService")
@Scope("singleton")
public class GoodsServiceImpl implements GoodsService {
	private static Logger logger = LoggerFactory.getLogger(GoodsServiceImpl.class);

	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

	@Autowired
	private GoodsMapper						goodsMapper;
	@Autowired
	private BrandMapper						brandMapper;
	@Autowired
	private GoodsNavigateMapper				goodsNavigateMapper;
	@Autowired
	private GoodsDetailMapper				goodsDetailMapper;
	@Autowired
	private InventoryMapper					inventoryMapper;
	@Autowired
	private GoodsCommissionMapper			goodsCommissionMapper;
	@Autowired
	private ShareGoodsMapper				shareGoodsMapper;
	@Autowired
	private GoodsCommentMapper				goodsCommentMapper;
	@Autowired
	private UserMapper						userMapper;
	@Autowired
	private GoodsSearchWordMapper			goodsSearchWordMapper;
	@Autowired
	private GoodsServicesMapper				goodsServicesMapper;
	@Autowired
	private TeacherStreamerMapper			teacherStreamerMapper;
	@Autowired
	private TeacherGoodsMapper				teacherGoodsMapper;
	@Autowired
	private HomePageStreamerMapper			homePageStreamerMapper;
	@Autowired
	private GoodsService					goodsService;
	@Autowired
	private ProductMapper					productMapper;
	@Autowired
	private UserInfoMapper					userInfoMapper;
	@Autowired
	private BaseRestrictionsMapper			baseRestrictionsMapper;
	@Autowired
	private UserService						userService;
	@Autowired
	private LimitTimeSaleDetailMapper		limitTimeSaleDetailMapper;
	@Autowired
	private BaseRestrictionsService			baseRestrictionsService;
	@Autowired
	private InventoryService				inventoryService;
	@Autowired
	private BrandUserEnjoyMapper			brandUserEnjoyMapper;
	@Autowired
	private OActivService					oActivService;
	@Autowired
	private RedisUtil						redisUtil;
	@Autowired
	private GoodsExtendedAttributeMapper	goodsExtendedAttributeMapper;
	@Autowired
	private StoreMapper						storeMapper;
	@Autowired
	private OverseasGoodsLableMapper		overseasGoodsLableMapper;

	@Override
	public List<OpenStoreGoodsVo> findOpenStoreGoods(boolean showAll, Date avlDay) {
		if (avlDay == null) {
			avlDay = new Date();
		}
		List<OpenStoreGoodsVo> rslt = new LinkedList<OpenStoreGoodsVo>();
		List<Goods> goodsList = goodsMapper.selectOpenStoreGoods(showAll, avlDay);
		if (CollectionUtils.isNotEmpty(goodsList)) {
			for (Goods goods : goodsList) {
				if (goods != null) {
					try {
						OpenStoreGoodsVo openStoreGoodsVo = new OpenStoreGoodsVo();
						openStoreGoodsVo.setGoodsId(goods.getId());
						openStoreGoodsVo.setName(goods.getName());
						openStoreGoodsVo.setMarketrice(goods.getSuggestedPrice());
						GoodsPrice goodsViewPriceForGoods = getGoodsViewPriceForGoods(null, goods.getId());
						if (goodsViewPriceForGoods == null) {
							logger.warn("开店礼包[{}-{}]销售价不存在,跳过", goods.getId(), goods.getName());
							continue;
						}
						openStoreGoodsVo.setSalePrice(goodsViewPriceForGoods.getNumber_salePrice());
						GoodsNavigate goodsNavigate = goodsNavigateMapper.selectGoodsNavigateByGoodIdGetOne(goods.getId());
						if (goodsNavigate != null) {
							openStoreGoodsVo.setImg(goodsNavigate.getNavigateImage());
						} else {
							openStoreGoodsVo.setImg(StringUtils.EMPTY);
						}
						rslt.add(openStoreGoodsVo);
					} catch (Exception e) {
						logger.warn("开店礼包[{}-{}]封装异常,跳过：{}", goods.getId(), goods.getName(), e.getMessage(), e);
					}
				}
			}
		}
		return rslt;
	}

	/**
	 * 根据商品在库存表的库存价和分享者、用户的角色计算最低价
	 * @author 高玮琪
	 * @return
	 */
	@Override
	public int getLowestPrice(Goods goods, int shareUserRoleId, int seeUserRoleId) {
		// 库存价
		int inventoryPrice = inventoryMapper.selectMinInventorySalePriceByGoodId(goods.getId());
		// 会员价
		int vipPrice = inventoryPrice * (100 - goods.getTalentLimit()) / 100;
		if (inventoryPrice == 0) {
			return goods.getSuggestedPrice();
		}
		if (shareUserRoleId > 1 || seeUserRoleId > 1) {
			return vipPrice;
		}
		return inventoryPrice;
	}

	@Autowired
	private StoreGoodsService storeGoodsService;

	@Override
	public GoodsVo selectGoodsById(long goodsId, int shareUserRoleId, int roleId) {
		Goods goods = goodsMapper.selectGoodsByIdTwo(goodsId);
		if (goods == null) {
			return null;
		}
		if (goods.getGoodsType() == 0 && (DateUtil.betweenTime(goods.getOnlineTime(), goods.getOfflineTime()) < 1)) {
			return null;
		}
		// 商品不为空，开始给商品的更多属性赋值
		GoodsVo vo = new GoodsVo(goods);
		Brand brand = brandMapper.selectBrandById(goods.getBrandId());
		if (brand == null) {
			vo.setBrand(new Brand());
		} else {
			vo.setBrand(brand);
		}
		int lowestPrice = getLowestPrice(goods, shareUserRoleId, roleId);
		vo.setLowestPrice(lowestPrice);
		// 商品介绍图
		List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(goodsId);
		vo.setGoodNavigateList(goodsNavigateList);
		// 微信小图
		if (goodsNavigateList != null && goodsNavigateList.size() > 0) {
			vo.setWxSmallImgpath(goodsNavigateList.get(0).getNavigateImage());
		} else {
			vo.setWxSmallImgpath("");
		}
		// 详情图
		List<GoodsDetail> goodsDetailList = goodsDetailMapper.selectGoodsDetailByGoodId(vo.getId(), GoodsImgType.ALL.getType());
		List<GoodsDetail> detailsList = new ArrayList<GoodsDetail>();
		List<GoodsDetail> specList = new ArrayList<GoodsDetail>();
		List<GoodsDetail> noticesList = new ArrayList<GoodsDetail>();
		for (GoodsDetail goodsDetail : goodsDetailList) {
			//详情
			if (goodsDetail.getImgType() == GoodsImgType.DETAIL.getType()) {
				detailsList.add(goodsDetail);
			} else if (goodsDetail.getImgType() == GoodsImgType.SPEC.getType()) {
				specList.add(goodsDetail);
			} else if (goodsDetail.getImgType() == GoodsImgType.NOTICE.getType()) {
				noticesList.add(goodsDetail);
			}
		}
		vo.setGoodDetailList(detailsList);
		vo.setGoodSpecImgList(specList);
		vo.setGoodsNoticeImgList(noticesList);
		// 商品服务项目
		vo.setGoodsServiceList(settingGoodsServiceList(goods));
		List<SpecDesc> specDescList = JSON.parseArray(goods.getSpecDesc(), SpecDesc.class);
		vo.setSpecDescList(specDescList);
		// 商品分佣
		GoodsCommission goodsCommission = goodsCommissionMapper.selectGoodsCommissionByGoodId(vo.getId(), roleId);
		if (goodsCommission != null) {
			double backMoney = goodsCommission.getCommission();
			Double commission = lowestPrice * (backMoney / 100);
			goodsCommission.setCommission(commission.intValue());
		} else {
			goodsCommission = new GoodsCommission();
		}
		vo.setGoodsCommission(goodsCommission);
		// 商品推荐数
		vo.setRecommendNum(shareGoodsMapper.selectShareGoodByGoodIdCount(vo.getId()));
		// 商品评论数
		vo.setCommentNum(goodsCommentMapper.selectGoodsCommentByGoodIdCount(vo.getId()));
		// 分享商品可增加的颜值数字
		vo.setShareYanzhi(baseRestrictionsMapper.selectExperienceForShareGoods());
		return vo;
	}

	@Override
	public GoodsPageVo selectGoodsPageById(long id, int roleId) {
		Goods goods = goodsMapper.selectGoodsById(id);
		if (goods == null) {
			return null;
		}
		Brand brand = brandMapper.selectBrandById(goods.getBrandId());
		if (brand == null) {
			return null;
		}
		GoodsPageVo vo = new GoodsPageVo(goods);
		// 品牌中文
		vo.setNameCn(brand.getNameCn());
		// 品牌英文
		vo.setNameEn(brand.getNameEn());
		// 品牌logo图
		vo.setLogoPath(brand.getLogoPath());
		// 通过商品id 查询库存信息 找到最低售价
		vo.setLowestPrice(getLowestPrice(goods, 0, roleId));
		// 介绍图
		GoodsNavigate goodsNavigate = goodsNavigateMapper.selectGoodsNavigateByGoodIdGetOne(vo.getId());
		// 只取商品介绍图的第一张 作为列表展示 (介绍图通过order_no排序)
		if (goodsNavigate != null) {
			vo.setGoodNavigateImage(goodsNavigate.getNavigateImage());
		} else {
			vo.setGoodNavigateImage("");
		}
		return vo;
	}

	@Override
	public ResponseEntity<?> getGoodsById(long goodsId, int shareUserRoleId, int seeUserRoleId, String livePlanId) {
		GoodsVo goodsVo = selectGoodsById(goodsId, shareUserRoleId, seeUserRoleId);
		if (goodsVo == null) {
			return new ResponseEntity<>(new ResponseBaseModel(ErrorEnum.C20401), HttpStatus.OK);
		}
		goodsVo.setLivePlanId(livePlanId);
		return new ResponseEntity<>(new ResponseResultModel<GoodsVo>(goodsVo), HttpStatus.OK);
	}

	@Override
	public ResponsePageModel<GoodsPageVo> selectGoodsPage(RequestPageBaseModel page) {
		List<GoodsPageVo> voList = new ArrayList<GoodsPageVo>();
		int count = goodsMapper.selectGoodsCount();
		List<Goods> list = goodsMapper.selectGoodsList(page.getStartIndex(), page.getPageSize());
		for (Goods goods : list) {
			GoodsPageVo vo = selectGoodsPageById(goods.getId(), page.getRoleId());
			if (vo != null) {
				voList.add(vo);
			}
		}
		return new ResponsePageModel<GoodsPageVo>(count, page.getPageSize(), page.getPageNum(), voList);
	}

	/**
	 * 校妆APP
	 */
	@Override
	public List<GoodsPageVo> listGoodsPageByBrandId(int brandId, int seeUserRoleId, int startIndex, int pageSize) {
		List<GoodsPageVo> voList = new ArrayList<GoodsPageVo>();
		List<Long> ids = goodsMapper.selectGoodsIdListByBrandId(brandId);
		if (ids != null && ids.size() > 0) {
			// 判断库存
			List<Long> goodsIdList = inventoryMapper.selectHasInventoryGoodsIds(ids);
			if (goodsIdList != null && goodsIdList.size() > 0) {
				// 有库存的商品ID
				List<Goods> list = goodsMapper.selectGoodsListByBrandIdAndGoodsIdList(brandId, goodsIdList, startIndex, pageSize);
				for (Goods goods : list) {
					GoodsPageVo vo = selectGoodsPageById(goods.getId(), seeUserRoleId);
					if (null != vo) {
						voList.add(vo);
					}
				}
			}
		}
		return voList;
	}

	/**
	 * 校妆APP品牌下的商品
	 */
	@Override
	public int countGoodsPageByBrandId(int brandId) {
		int count = 0;
		List<Long> ids = goodsMapper.selectGoodsIdListByBrandId(brandId);
		if (ids != null && ids.size() > 0) {
			// 判断库存
			List<Long> goodsIdList = inventoryMapper.selectHasInventoryGoodsIds(ids);
			if (goodsIdList != null && goodsIdList.size() > 0) {
				// 有库存的商品ID
				List<Goods> list = goodsMapper.selectGoodsListByBrandIdAndGoodsIdListNum(brandId, goodsIdList);
				for (Goods goods : list) {
					GoodsPageVo vo = selectGoodsPageById(goods.getId(), 0);
					if (null != vo) {
						count = count + 1;
					}
				}
			}
		}
		return count;
	}

	@Override
	public ResponseEntity<?> listGoodsPageByCategoryId(int categoryId, List<Integer> brandIdList, int order, long userId, int pageNum, int startIndex, int pageSize) {
		List<GoodsSimpleVo> list = new ArrayList<GoodsSimpleVo>();
		List<GoodsSimpleVo> countList = new ArrayList<GoodsSimpleVo>();
		String orderBy = "ASC";
		if (order == 2) {
			orderBy = "DESC";
		}
		if (brandIdList == null || brandIdList.size() == 0) {
			brandIdList = new ArrayList<Integer>();
		}
		int roleId = 0;
		if (userId > 0) {
			User user = userMapper.selectByPrimaryKey(userId);
			if (user != null) {
				roleId = user.getRoleId();
			}
		}
		// 这里返回的是库存最低价
		list = goodsMapper.listGoodsPageByCategoryId(categoryId, brandIdList, orderBy, startIndex, pageSize);
		countList = goodsMapper.countGoodsByCategoryId(categoryId, brandIdList);
		if (list != null && list.size() > 0) {
			for (GoodsSimpleVo vo : list) {
				vo.setGoodNavigateImage(vo.getNavigateImage());
				if (roleId > 1) {// 如果当前登录的用户是会员或更高角色，这里看到会员价
					vo.setLowestPrice(vo.getLowestPrice() * (100 - vo.getTalentLimit()) / 100);
				}
			}
		}
		return new ResponseEntity<>(new ResponseResultModel<>(new ResponsePageModel<GoodsSimpleVo>(countList.size(), pageSize, pageNum, list)), HttpStatus.OK);
	}

	@Override
	public ResponsePageModel<Brand> listBrandIdByCategoryId(int categoryId) {
		// 根据子分类id查询 所有的商品 得到这些商品的 品牌id 集合 去除重复了
		List<Integer> brandIdList = goodsMapper.selectBrandIdListByCategoryId(categoryId);
		List<Brand> brandList = new ArrayList<>();
		// 循环查询品牌详情
		for (Integer brandId : brandIdList) {
			Brand brand = brandMapper.selectBrandById(brandId);
			if (brand != null) {
				brandList.add(brand);
			}
		}
		return new ResponsePageModel<Brand>(brandList.size(), brandList.size(), 1, brandList);
	}

	@Override
	public ResponseEntity<?> hotSale(long userId, int pageNum, int startIndex, int pageSize) {
		int roleId = 0;
		if (userId > 0) {
			User user = userMapper.selectByPrimaryKey(userId);
			if (user != null) {
				roleId = user.getRoleId();
			}
		}
		List<GoodsSimpleVo> goodsList = new ArrayList<GoodsSimpleVo>();
		List<Long> idLimit40 = goodsMapper.selectHotSaleLimit40();
		if (idLimit40 != null && idLimit40.size() > 0) {
			// 数据库里一次查出所有要展示的商品列表信息，查出来的价格是库存价，如果是会员或更高角色，下面单独处理
			goodsList = goodsMapper.selectGoodsHotSales(idLimit40, startIndex, pageSize);
			if (goodsList != null && goodsList.size() > 0) {
				for (GoodsSimpleVo simpleVo : goodsList) {
					if (simpleVo != null) {
						simpleVo.setGoodNavigateImage(simpleVo.getNavigateImage());
						simpleVo.setLowestPrice(getLowestPrice(simpleVo, 0, roleId));
					}
				}
			}
		}
		int count = 0;
		List<GoodsSimpleVo> countGoodsList = new ArrayList<GoodsSimpleVo>();
		countGoodsList = goodsMapper.countGoodsHotSales(idLimit40);
		if (countGoodsList != null && countGoodsList.size() > 0) {
			for (GoodsSimpleVo simpleVo2 : countGoodsList) {
				if (simpleVo2 != null) {
					count += 1;
				}
			}
		}
		return new ResponseEntity<>(new ResponseResultModel<>(new ResponsePageModel<GoodsSimpleVo>(count, pageSize, pageNum, goodsList)), HttpStatus.OK);
	}

	@Override
	public GoodsSimpleVo toSimpleGoodsVo(Goods goods, int shareUserRoleId, int roleId) {
		GoodsSimpleVo simpleVo = new GoodsSimpleVo();
		BeanUtils.copyProperties(goods, simpleVo);
		simpleVo.setGoodId(goods.getId());
		simpleVo.setGoodNavigateImage(getGoodsPicture(goods.getId()));
		simpleVo.setLowestPrice(getLowestPrice(goods, shareUserRoleId, roleId));
		return simpleVo;
	}

	@Override
	public List<GoodsNavigate> selectGoodImgByGoodIdList(List<Long> goodIdList) {
		return goodsNavigateMapper.selectGoodImgByGoodIdList(goodIdList);
	}

	/**
	 * 校妆APP获取商品热搜词
	 * 
	 * @author 卫耀华
	 * @return
	 */
	@Override
	public List<String> getHotSearchWords() {
		List<String> list = new ArrayList<String>();
		list = goodsSearchWordMapper.selectGoodsSearchWordLimit8();
		return list;
	}

	/**
	 * ES搜商品--分页
	 * 
	 * @param goodsType
	 * @param roleId
	 * @param searchKeyWord
	 * @param startIndex
	 * @param pageSize
	 * @return
	 * @throws Exception
	 */
	@Override
	public List<GoodsSimpleVo> esSearchGoods(int goodsType, int roleId, String searchKeyWord, int startIndex, int pageSize) throws Exception {
		List<GoodsSimpleVo> simpleGoodsVoList = new ArrayList<GoodsSimpleVo>();
		List<String> jsonStrList = new ArrayList<String>();
		// goodsType0是查C区，1是查B区
		if (goodsType == 0) {
			jsonStrList = ESUtil.searchGoods(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_C, startIndex, pageSize, searchKeyWord);
		} else if (goodsType == 1) {
			jsonStrList = ESUtil.searchGoods(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_B, startIndex, pageSize, searchKeyWord);
		}
		if (jsonStrList != null && jsonStrList.size() > 0) {
			for (String jsonStr : jsonStrList) {
				if (!StringUtils.isEmpty(jsonStr)) {
					//					ObjectMapper mapper = new ObjectMapper();
					//					JSONObject jsonObject = mapper.readValue(jsonStr, JSONObject.class);
					JSONObject jsonObject = JSONObject.parseObject(jsonStr);
					if (jsonObject != null) {
						long goodsId = jsonObject.getLongValue("id");
						Goods goods = goodsMapper.selectGoodsById(goodsId);
						if (goods != null) {
							GoodsSimpleVo vo = new GoodsSimpleVo();
							vo.setGoodId(goodsId);
							vo.setName(jsonObject.getString("name"));
							vo.setLabelName(jsonObject.getString("labelName"));
							vo.setLowestPrice(getLowestPrice(goods, 0, roleId));// 最低价特殊处理
							vo.setSuggestedPrice(goods.getSuggestedPrice());
							vo.setGoodNavigateImage(getGoodsPicture(goodsId));
							vo.setGoodsType(jsonObject.getIntValue("goodsType"));
							vo.setSelfSupport(jsonObject.getIntValue("selfSupport"));
							simpleGoodsVoList.add(vo);
						}
					}
				}
			}
		}
		// 添加或更新搜索词汇
		List<GoodsSearchWord> searchWords = goodsSearchWordMapper.selectGoodsSearchWordBySearchWord(searchKeyWord);
		if (searchWords != null && searchWords.size() > 0) {
			goodsSearchWordMapper.updateGoodsSearchWordNumBySearchWord(searchKeyWord);
		} else {
			goodsSearchWordMapper.insertGoodsSearchWord(searchKeyWord);
		}
		return simpleGoodsVoList;
	}

	/**
	 * ES搜商品--count
	 * 
	 * @param goodsType
	 * @param searchKeyWord
	 * @return
	 * @throws Exception
	 */
	@Override
	public int esSearchGoodsCount(int goodsType, String searchKeyWord) throws Exception {
		List<String> jsonStrList = new ArrayList<String>();
		// goodsType0是查C区，1是查B区
		if (goodsType == 0) {
			jsonStrList = ESUtil.searchGoodsCount(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_C, searchKeyWord);
		} else if (goodsType == 1) {
			jsonStrList = ESUtil.searchGoodsCount(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_B, searchKeyWord);
		}
		return jsonStrList.size();
	}

	/**
	 * 校妆APP拼装商品服务项目
	 * 
	 * @author 卫耀华
	 * @param goods
	 * @return
	 */
	private List<GoodsServiceVo> settingGoodsServiceList(Goods goods) {
		List<GoodsServiceVo> goodsServiceList = null;
		String serviceDesc = goods.getServiceDesc();
		if (!StringUtils.isEmpty(serviceDesc)) {
			List<Integer> idList = new ArrayList<Integer>();
			if (serviceDesc.contains(",")) {
				String[] serviceDescArr = serviceDesc.split(",");
				for (int i = 0; i < serviceDescArr.length; i++) {
					idList.add(Integer.parseInt(serviceDescArr[i]));
				}
			} else {
				idList.add(Integer.parseInt(serviceDesc));
			}
			List<GoodsServices> goodsServiceDescList = goodsServicesMapper.findGoodsServicesListByIdList(idList);
			if (goodsServiceDescList != null && goodsServiceDescList.size() > 0) {
				goodsServiceList = new ArrayList<GoodsServiceVo>();
				for (GoodsServices goodsServices : goodsServiceDescList) {
					if (goods.getRefund() == 0 && goodsServices.getId() == 11) {// 商品属性 不能退换货
						continue;
					}
					GoodsServiceVo goodsServiceVo = new GoodsServiceVo();
					goodsServiceVo.setGoodsServiceId(goodsServices.getId());
					goodsServiceVo.setImage(goodsServices.getImage());
					goodsServiceVo.setName(goodsServices.getName());
					goodsServiceVo.setContent(goodsServices.getContent());
					goodsServiceList.add(goodsServiceVo);
				}
			}
		}
		return goodsServiceList;
	}

	/**
	 * 校妆APP讲师推荐商品列表分页
	 * 
	 * @author 卫耀华
	 * @param userId
	 * @param startIndex
	 * @param pageSize
	 * @return
	 */
	@Override
	public List<GoodsSimpleVo> jiangShiTuiJianGoods(Long userId, int startIndex, Integer pageSize) {
		logger.info("---begin---jiangShiTuiJianGoods---impl---");
		List<GoodsSimpleVo> voList = new ArrayList<GoodsSimpleVo>();
		int roleId = 0;
		User user = userMapper.selectByPrimaryKey(userId);
		if (user != null) {
			roleId = user.getRoleId();
		}
		List<Long> goodsIdList = goodsMapper.selectJiangshiGoodsIdList();
		if (goodsIdList != null && goodsIdList.size() > 0) {
			List<Goods> goodsList = goodsMapper.selectGoodsType1ByIdListPage(goodsIdList, startIndex, pageSize);
			if (goodsList != null && goodsList.size() > 0) {
				for (Goods goods : goodsList) {
					if (goods != null) {
						GoodsSimpleVo vo = toSimpleGoodsVo(goods, 0, roleId);
						if (vo != null) {
							voList.add(vo);
						}
					}
				}
			}
		}
		logger.info("---end---jiangShiTuiJianGoods---impl---");
		return voList;
	}

	/**
	 * 校妆APP讲师推荐商品列表分页总记录数
	 * 
	 * @author 卫耀华
	 * @return
	 */
	@Override
	public int countTeacherRecommendGoods() {
		logger.info("---begin---countTeacherRecommendGoods---impl---");
		int num = 0;
		List<Long> goodsIdList = goodsMapper.selectJiangshiGoodsIdList();
		if (goodsIdList != null && goodsIdList.size() > 0) {
			List<Goods> goodsList = goodsMapper.selectGoodsType1ByIdList(goodsIdList);
			num = goodsList.size();
		}
		logger.info("---end---countTeacherRecommendGoods---impl---");
		return num;
	}

	@Override
	public InventoryVo selectInventoryById(long inventoryId) {
		return goodsMapper.selectInventoryById(inventoryId);
	}

	/**
	 * 获取商品列表中要展示的主图片（一张）(校妆网APP)
	 * 
	 * @author 卫耀华
	 * @param goodsId
	 * @return
	 */
	@Override
	public String getGoodsPicture(long goodsId) {
		String goodsPicture = "";
		GoodsNavigate goodsNavigate = goodsNavigateMapper.selectGoodsNavigateByGoodIdGetOne(goodsId);
		if (goodsNavigate != null) {
			goodsPicture = goodsNavigate.getNavigateImage();
		}
		return goodsPicture;
	}

	@Override
	public List<GoodsSimpleVo> simpleGoodsTrans(List<SimpleGoods> goodsList, int shareUserRoleId, int roleId) {
		List<GoodsSimpleVo> voList = new ArrayList<GoodsSimpleVo>();
		if (goodsList != null && goodsList.size() > 0) {
			for (SimpleGoods simple : goodsList) {
				GoodsSimpleVo simpleVo = new GoodsSimpleVo();
				BeanUtils.copyProperties(simple, simpleVo);
				simpleVo.setGoodNavigateImage(simple.getNavigateImage());
				simpleVo.setGoodId(simple.getId());
				if (simple.getSalePrice() == 0) {
					simpleVo.setLowestPrice(simple.getSuggestedPrice());
				} else {
					if (shareUserRoleId > 1 || roleId > 1) {
						simpleVo.setLowestPrice(simple.getSalePrice() * (100 - simple.getTalentLimit()) / 100);
					} else {
						simpleVo.setLowestPrice(simple.getSalePrice());
					}
				}
				voList.add(simpleVo);
			}
		}
		return voList;
	}

	@Override
	public List<GoodsResponse> selectGoodsResponse(long teacherId) throws ParseException {
		User user = userMapper.selectByPrimaryKey(teacherId);
		if (user.getRoleId() == 7) {
			if (user.getIsOpenRecommand() == 1) {
				TeacherStreamer teacherStreamer = teacherStreamerMapper.selectByTeacherId(teacherId);
				if (teacherStreamer == null) {
					// 打开了但是自己没有添加过内容
					// 1
					List<GoodsResponse> listGoodsResponse = new ArrayList<GoodsResponse>();
					List<TeacherStreamer> listTeacherStreamer = teacherStreamerMapper.selectAllDefault1();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList1();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 2
					List<TeacherStreamer> listTeacherStreamer2 = teacherStreamerMapper.selectAllDefault2();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer2) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList2();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 3
					List<TeacherStreamer> listTeacherStreamer3 = teacherStreamerMapper.selectAllDefault3();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer3) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList3();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 4
					List<TeacherStreamer> listTeacherStreamer4 = teacherStreamerMapper.selectAllDefault4();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer4) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList4();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 5
					List<TeacherStreamer> listTeacherStreamer5 = teacherStreamerMapper.selectAllDefault5();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer5) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList5();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 6
					List<TeacherStreamer> listTeacherStreamer6 = teacherStreamerMapper.selectAllDefault6();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer6) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList6();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 7
					List<TeacherStreamer> listTeacherStreamer7 = teacherStreamerMapper.selectAllDefault7();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer7) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList7();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 8
					List<TeacherStreamer> listTeacherStreamer8 = teacherStreamerMapper.selectAllDefault8();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer8) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList8();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 9
					List<TeacherStreamer> listTeacherStreamer9 = teacherStreamerMapper.selectAllDefault9();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer9) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList9();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 10
					List<TeacherStreamer> listTeacherStreamer10 = teacherStreamerMapper.selectAllDefault10();
					for (TeacherStreamer homePageStreamer : listTeacherStreamer10) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
						GoodsResponse.setImagePath(homePageStreamer.getImagePath());
						GoodsResponse.setStreamerId(homePageStreamer.getId());
						if (homePageStreamer.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						// List<Long> goodsIdList =
						// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
						List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList10();
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user.getRoleId()));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					return listGoodsResponse;
				}
				// 打开了自己有内容
				if (teacherStreamer != null) {
					// 1
					List<GoodsResponse> listGoodsResponse = new ArrayList<GoodsResponse>();
					List<TeacherStreamer> listTeacherStreamer1 = teacherStreamerMapper.selectAll1(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer1) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 0, 4);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher1(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 2
					List<TeacherStreamer> listTeacherStreamer2 = teacherStreamerMapper.selectAll2(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer2) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 4, 4);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher2(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 3
					List<TeacherStreamer> listTeacherStreamer3 = teacherStreamerMapper.selectAll3(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer3) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 8, 4);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher3(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 4
					List<TeacherStreamer> listTeacherStreamer4 = teacherStreamerMapper.selectAll4(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer4) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 12, 6);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher4(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 5
					List<TeacherStreamer> listTeacherStreamer5 = teacherStreamerMapper.selectAll5(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer5) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 18, 6);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher5(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 6
					List<TeacherStreamer> listTeacherStreamer6 = teacherStreamerMapper.selectAll6(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer6) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 24, 6);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher6(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 7
					List<TeacherStreamer> listTeacherStreamer7 = teacherStreamerMapper.selectAll7(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer7) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 30, 8);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher7(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 8
					List<TeacherStreamer> listTeacherStreamer8 = teacherStreamerMapper.selectAll8(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer8) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 38, 8);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher8(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 9
					List<TeacherStreamer> listTeacherStreamer9 = teacherStreamerMapper.selectAll9(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer9) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 46, 8);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher9(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					// 10
					List<TeacherStreamer> listTeacherStreamer10 = teacherStreamerMapper.selectAll10(teacherId);
					for (TeacherStreamer teacherStreamer1 : listTeacherStreamer10) {
						GoodsResponse GoodsResponse = new GoodsResponse();
						GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
						GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
						GoodsResponse.setStreamerId(teacherStreamer1.getId());
						GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
						if (teacherStreamer1.getGoodsId() != 0) {
							Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
							if (goods != null) {
								GoodsResponse.setSelfSupport(goods.getSelfSupport());
							}
						}
						List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId, 54, 8);// all
						// List<Goods> listGoods =
						// goodsMapper.selectGoodsByIdListTeacher10(goodsIdList,
						// teacherId);
						List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
						for (Goods Goods : listGoods) {
							GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
							Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
							goodsDetailResponse.setBrandName(brand.getNameCn());
							goodsDetailResponse.setGoodId(Goods.getId());
							if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
								goodsDetailResponse.setGoodsisShowNormal(0);
							} else {
								if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
									goodsDetailResponse.setGoodsisShowNormal(1);
								} else {
									goodsDetailResponse.setGoodsisShowNormal(0);
								}
							}
							if (Goods.getInventoryNum() >= 1) {
								goodsDetailResponse.setGoodsisHaveInventory(1);
							} else {
								goodsDetailResponse.setGoodsisHaveInventory(0);
							}
							goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
							goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
							List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
							goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
							goodsDetailResponse.setLabelName(Goods.getLabelName());
							goodsDetailResponse.setGoodsName(Goods.getName());
							goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
							listGoodsDetailResponse.add(goodsDetailResponse);
						}
						GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
						listGoodsResponse.add(GoodsResponse);
					}
					return listGoodsResponse;
				}
			}
			// 没有打开
			List<GoodsResponse> listGoodsResponse = new ArrayList<GoodsResponse>();
			List<TeacherStreamer> listTeacherStreamer1 = teacherStreamerMapper.selectAllDefault1();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer1) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList1();
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 2
			List<TeacherStreamer> listTeacherStreamer2 = teacherStreamerMapper.selectAllDefault2();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer2) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList2();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 3
			List<TeacherStreamer> listTeacherStreamer3 = teacherStreamerMapper.selectAllDefault3();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer3) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList3();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 4
			List<TeacherStreamer> listTeacherStreamer4 = teacherStreamerMapper.selectAllDefault4();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer4) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList4();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 5
			List<TeacherStreamer> listTeacherStreamer5 = teacherStreamerMapper.selectAllDefault5();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer5) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList5();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 6
			List<TeacherStreamer> listTeacherStreamer6 = teacherStreamerMapper.selectAllDefault6();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer6) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList6();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 7
			List<TeacherStreamer> listTeacherStreamer7 = teacherStreamerMapper.selectAllDefault7();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer7) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList7();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 8
			List<TeacherStreamer> listTeacherStreamer8 = teacherStreamerMapper.selectAllDefault8();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer8) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList8();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 9
			List<TeacherStreamer> listTeacherStreamer9 = teacherStreamerMapper.selectAllDefault9();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer9) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList9();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			// 10
			List<TeacherStreamer> listTeacherStreamer10 = teacherStreamerMapper.selectAllDefault10();
			for (TeacherStreamer homePageStreamer : listTeacherStreamer10) {
				GoodsResponse GoodsResponse = new GoodsResponse();
				GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
				GoodsResponse.setImagePath(homePageStreamer.getImagePath());
				GoodsResponse.setStreamerId(homePageStreamer.getId());
				if (homePageStreamer.getGoodsId() != 0) {
					Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
					if (goods != null) {
						GoodsResponse.setSelfSupport(goods.getSelfSupport());
					}
				}
				// List<Long> goodsIdList =
				// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
				List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList10();
				List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
				for (Goods Goods : listGoods) {
					GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
					Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
					goodsDetailResponse.setBrandName(brand.getNameCn());
					goodsDetailResponse.setGoodId(Goods.getId());
					if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
						goodsDetailResponse.setGoodsisShowNormal(0);
					} else {
						if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
							goodsDetailResponse.setGoodsisShowNormal(1);
						} else {
							goodsDetailResponse.setGoodsisShowNormal(0);
						}
					}
					if (Goods.getInventoryNum() >= 1) {
						goodsDetailResponse.setGoodsisHaveInventory(1);
					} else {
						goodsDetailResponse.setGoodsisHaveInventory(0);
					}
					goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 1));
					goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
					List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
					goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
					goodsDetailResponse.setLabelName(Goods.getLabelName());
					goodsDetailResponse.setGoodsName(Goods.getName());
					goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
					listGoodsDetailResponse.add(goodsDetailResponse);
				}
				GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
				listGoodsResponse.add(GoodsResponse);
			}
			return listGoodsResponse;
		}
		long teacherId2 = userInfoMapper.selectUserIdByPersionId(user.getRecommendFrom());
		User user1 = userMapper.selectByPrimaryKey(teacherId2);
		if (user1.getIsOpenRecommand() == 1) {
			TeacherStreamer teacherStreamer = teacherStreamerMapper.selectByTeacherId(teacherId2);
			if (teacherStreamer == null) {
				// 打开了但是自己没有添加过内容
				// 1
				List<GoodsResponse> listGoodsResponse = new ArrayList<GoodsResponse>();
				List<TeacherStreamer> listTeacherStreamer = teacherStreamerMapper.selectAllDefault1();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList1();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 2
				List<TeacherStreamer> listTeacherStreamer2 = teacherStreamerMapper.selectAllDefault2();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer2) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList2();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 3
				List<TeacherStreamer> listTeacherStreamer3 = teacherStreamerMapper.selectAllDefault3();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer3) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList3();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 4
				List<TeacherStreamer> listTeacherStreamer4 = teacherStreamerMapper.selectAllDefault4();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer4) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList4();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 5
				List<TeacherStreamer> listTeacherStreamer5 = teacherStreamerMapper.selectAllDefault5();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer5) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList5();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 6
				List<TeacherStreamer> listTeacherStreamer6 = teacherStreamerMapper.selectAllDefault6();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer6) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList6();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 7
				List<TeacherStreamer> listTeacherStreamer7 = teacherStreamerMapper.selectAllDefault7();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer7) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList7();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 8
				List<TeacherStreamer> listTeacherStreamer8 = teacherStreamerMapper.selectAllDefault8();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer8) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList8();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 9
				List<TeacherStreamer> listTeacherStreamer9 = teacherStreamerMapper.selectAllDefault9();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer9) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList9();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 10
				List<TeacherStreamer> listTeacherStreamer10 = teacherStreamerMapper.selectAllDefault10();
				for (TeacherStreamer homePageStreamer : listTeacherStreamer10) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
					GoodsResponse.setImagePath(homePageStreamer.getImagePath());
					GoodsResponse.setStreamerId(homePageStreamer.getId());
					if (homePageStreamer.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					// List<Long> goodsIdList =
					// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
					List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList10();
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				return listGoodsResponse;
			}
			// 打开了自己有内容
			if (teacherStreamer != null) {
				// 1
				List<GoodsResponse> listGoodsResponse = new ArrayList<GoodsResponse>();
				List<TeacherStreamer> listTeacherStreamer1 = teacherStreamerMapper.selectAll1(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer1) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 0, 4);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher1(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 2
				List<TeacherStreamer> listTeacherStreamer2 = teacherStreamerMapper.selectAll2(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer2) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 4, 4);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher2(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 3
				List<TeacherStreamer> listTeacherStreamer3 = teacherStreamerMapper.selectAll3(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer3) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 8, 4);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher3(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 4
				List<TeacherStreamer> listTeacherStreamer4 = teacherStreamerMapper.selectAll4(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer4) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 12, 6);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher4(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 5
				List<TeacherStreamer> listTeacherStreamer5 = teacherStreamerMapper.selectAll5(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer5) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 18, 6);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher5(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 6
				List<TeacherStreamer> listTeacherStreamer6 = teacherStreamerMapper.selectAll6(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer6) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 24, 6);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher6(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 7
				List<TeacherStreamer> listTeacherStreamer7 = teacherStreamerMapper.selectAll7(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer7) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 30, 8);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher7(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 8
				List<TeacherStreamer> listTeacherStreamer8 = teacherStreamerMapper.selectAll8(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer8) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 38, 8);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher8(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 9
				List<TeacherStreamer> listTeacherStreamer9 = teacherStreamerMapper.selectAll9(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer9) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 46, 8);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher9(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				// 10
				List<TeacherStreamer> listTeacherStreamer10 = teacherStreamerMapper.selectAll10(teacherId2);
				for (TeacherStreamer teacherStreamer1 : listTeacherStreamer10) {
					GoodsResponse GoodsResponse = new GoodsResponse();
					GoodsResponse.setGoodsId(teacherStreamer1.getGoodsId());
					GoodsResponse.setImagePath(teacherStreamer1.getImagePath());
					GoodsResponse.setStreamerId(teacherStreamer1.getId());
					GoodsResponse.setStreamerId(teacherStreamer1.getStreamerId());
					if (teacherStreamer1.getGoodsId() != 0) {
						Goods goods = goodsMapper.selectGoodsById(teacherStreamer1.getGoodsId());
						if (goods != null) {
							GoodsResponse.setSelfSupport(goods.getSelfSupport());
						}
					}
					List<Goods> listGoods = teacherGoodsMapper.selectTeacherGoodsByTeacherIdAndBaner(teacherId2, 54, 8);// all
					// List<Goods> listGoods =
					// goodsMapper.selectGoodsByIdListTeacher10(goodsIdList,
					// teacherId2);
					List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
					for (Goods Goods : listGoods) {
						GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
						Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
						goodsDetailResponse.setBrandName(brand.getNameCn());
						goodsDetailResponse.setGoodId(Goods.getId());
						if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
							goodsDetailResponse.setGoodsisShowNormal(0);
						} else {
							if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
								goodsDetailResponse.setGoodsisShowNormal(1);
							} else {
								goodsDetailResponse.setGoodsisShowNormal(0);
							}
						}
						if (Goods.getInventoryNum() >= 1) {
							goodsDetailResponse.setGoodsisHaveInventory(1);
						} else {
							goodsDetailResponse.setGoodsisHaveInventory(0);
						}
						goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
						goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
						List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
						goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
						goodsDetailResponse.setLabelName(Goods.getLabelName());
						goodsDetailResponse.setGoodsName(Goods.getName());
						goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
						listGoodsDetailResponse.add(goodsDetailResponse);
					}
					GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
					listGoodsResponse.add(GoodsResponse);
				}
				return listGoodsResponse;
			}
		}
		// 没有打开
		List<GoodsResponse> listGoodsResponse = new ArrayList<GoodsResponse>();
		List<TeacherStreamer> listTeacherStreamer1 = teacherStreamerMapper.selectAllDefault1();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer1) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList1();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				int count = inventoryMapper.selectInventoryByGoodsId(Goods.getId());
				if (count >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 2
		List<TeacherStreamer> listTeacherStreamer2 = teacherStreamerMapper.selectAllDefault2();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer2) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList2();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 3
		List<TeacherStreamer> listTeacherStreamer3 = teacherStreamerMapper.selectAllDefault3();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer3) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList3();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 4
		List<TeacherStreamer> listTeacherStreamer4 = teacherStreamerMapper.selectAllDefault4();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer4) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList4();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 5
		List<TeacherStreamer> listTeacherStreamer5 = teacherStreamerMapper.selectAllDefault5();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer5) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList5();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 6
		List<TeacherStreamer> listTeacherStreamer6 = teacherStreamerMapper.selectAllDefault6();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer6) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList6();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 7
		List<TeacherStreamer> listTeacherStreamer7 = teacherStreamerMapper.selectAllDefault7();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer7) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList7();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 8
		List<TeacherStreamer> listTeacherStreamer8 = teacherStreamerMapper.selectAllDefault8();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer8) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList8();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 9
		List<TeacherStreamer> listTeacherStreamer9 = teacherStreamerMapper.selectAllDefault9();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer9) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList9();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}
		// 10
		List<TeacherStreamer> listTeacherStreamer10 = teacherStreamerMapper.selectAllDefault10();
		for (TeacherStreamer homePageStreamer : listTeacherStreamer10) {
			GoodsResponse GoodsResponse = new GoodsResponse();
			GoodsResponse.setGoodsId(homePageStreamer.getGoodsId());
			GoodsResponse.setImagePath(homePageStreamer.getImagePath());
			GoodsResponse.setStreamerId(homePageStreamer.getId());
			if (homePageStreamer.getGoodsId() != 0) {
				Goods goods = goodsMapper.selectGoodsById(homePageStreamer.getGoodsId());
				if (goods != null) {
					GoodsResponse.setSelfSupport(goods.getSelfSupport());
				}
			}
			// List<Long> goodsIdList =
			// teacherGoodsMapper.selectTeacherGoodsIsdefault();//all
			List<Goods> listGoods = goodsMapper.selectGoodsType1ByIdList10();
			List<GoodsDetailResponse> listGoodsDetailResponse = new ArrayList<GoodsDetailResponse>();
			for (Goods Goods : listGoods) {
				GoodsDetailResponse goodsDetailResponse = new GoodsDetailResponse();
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsDetailResponse.setBrandName(brand.getNameCn());
				goodsDetailResponse.setGoodId(Goods.getId());
				if (Goods.getOnlineTime() == null || Goods.getOfflineTime() == null) {
					goodsDetailResponse.setGoodsisShowNormal(0);
				} else {
					if (DateUtil.betweenTime(Goods.getOnlineTime(), Goods.getOfflineTime()) == 1) {
						goodsDetailResponse.setGoodsisShowNormal(1);
					} else {
						goodsDetailResponse.setGoodsisShowNormal(0);
					}
				}
				if (Goods.getInventoryNum() >= 1) {
					goodsDetailResponse.setGoodsisHaveInventory(1);
				} else {
					goodsDetailResponse.setGoodsisHaveInventory(0);
				}
				goodsDetailResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, user1.getRoleId()));
				goodsDetailResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				goodsDetailResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				goodsDetailResponse.setLabelName(Goods.getLabelName());
				goodsDetailResponse.setGoodsName(Goods.getName());
				goodsDetailResponse.setSelfSupport(Goods.getSelfSupport());
				listGoodsDetailResponse.add(goodsDetailResponse);
			}
			GoodsResponse.setListGoodsDetailResponse(listGoodsDetailResponse);
			listGoodsResponse.add(GoodsResponse);
		}

		return listGoodsResponse;
	}

	@Override
	public int insertTeacherMessage(List<GoodsResponse> listGoodsResponse, long teacherId) {
		teacherGoodsMapper.deleteTeacherGoods(teacherId);
		teacherStreamerMapper.deleteTeacherStreamer(teacherId);
		for (GoodsResponse goodsResponse : listGoodsResponse) {
			teacherStreamerMapper.insertTeacherStreamer(goodsResponse.getImagePath(), goodsResponse.getGoodsId(), teacherId, goodsResponse.getStreamerId());
			for (GoodsDetailResponse GoodsDetailResponse : goodsResponse.getListGoodsDetailResponse()) {
				teacherGoodsMapper.insertTeacherGoods(GoodsDetailResponse.getGoodId(), teacherId, 0);
			}
		}
		return 1;
	}

	@Override
	public List<StreamerResponse> listStreamerResponse(long teacherId) {
		List<StreamerResponse> listStreamerResponse = new ArrayList<StreamerResponse>();
		List<HomePageStreamer> listHomePageStreamer = homePageStreamerMapper.selectHomePageStreamerList();
		for (HomePageStreamer HomePageStreamer : listHomePageStreamer) {
			StreamerResponse streamerResponse = new StreamerResponse();
			streamerResponse.setImagePath(HomePageStreamer.getImagePath());
			streamerResponse.setStreamerId(HomePageStreamer.getId());
			if (HomePageStreamer.getGoodsId() != 0) {
				Goods Goods = goodsMapper.selectGoodsById(HomePageStreamer.getGoodsId());
				if (Goods == null) {
					continue;
				}
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				streamerResponse.setBrandName(brand.getNameCn());
				streamerResponse.setLabelName(Goods.getLabelName());
				streamerResponse.setGoodsName(Goods.getName());
				streamerResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 7));
				streamerResponse.setGoodsId(Goods.getId());
				streamerResponse.setSelfSupport(Goods.getSelfSupport());
			}
			List<TeacherStreamer> listTeacherStreamer = teacherStreamerMapper.selectTeacherStreamerByTeacherId(teacherId);
			for (TeacherStreamer teacherStreamer : listTeacherStreamer) {
				int a = 0;
				if (HomePageStreamer.getId() != teacherStreamer.getStreamerId()) {
					a = 0;
				}
				if (HomePageStreamer.getId() == teacherStreamer.getStreamerId()) {
					a = 1;
				}
				if (a == 1) {
					streamerResponse.setIsShow(a);

				}
			}
			listStreamerResponse.add(streamerResponse);
		}
		return listStreamerResponse;
	}

	@Override
	public List<GoodsListResponse> GoodsListResponse(long teacherId, int page, int pageSize, int orderType) {
		List<GoodsListResponse> listGoodsListResponse = new ArrayList<GoodsListResponse>();
		if (orderType == 0) {
			List<Goods> listGoods = goodsMapper.selectGoodsGoodsTypeAll(page, pageSize);
			for (Goods Goods : listGoods) {
				GoodsListResponse goodsListResponse = new GoodsListResponse();
				goodsListResponse.setGoodId(Goods.getId());
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsListResponse.setBrandName(brand.getNameCn());
				goodsListResponse.setGoodId(Goods.getId());
				goodsListResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 7));
				goodsListResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				if (goodsNavigateList.size() <= 0) {
					goodsListResponse.setGoodNavigateImage("");
				} else {
					goodsListResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				}
				goodsListResponse.setLabelName(Goods.getLabelName());
				goodsListResponse.setGoodsName(Goods.getName());
				goodsListResponse.setSelfSupport(Goods.getSelfSupport());
				List<TeacherGoods> listTeacherGoods = teacherGoodsMapper.selectTeacherGoods(teacherId);
				for (TeacherGoods TeacherGoods : listTeacherGoods) {
					int a = 0;
					if (Goods.getId() != TeacherGoods.getGoodsId()) {
						a = 0;
					}
					if (Goods.getId() == TeacherGoods.getGoodsId()) {
						a = 1;
					}
					if (a == 1) {
						goodsListResponse.setIsShow(a);
					}
				}
				listGoodsListResponse.add(goodsListResponse);
			}
		}
		if (orderType == 1) {
			List<Goods> listGoods = goodsMapper.selectGoodsGoodsTypeAllAsc(page, pageSize);
			for (Goods Goods : listGoods) {
				GoodsListResponse goodsListResponse = new GoodsListResponse();
				goodsListResponse.setGoodId(Goods.getId());
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsListResponse.setBrandName(brand.getNameCn());
				goodsListResponse.setGoodId(Goods.getId());
				goodsListResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 7));
				goodsListResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				if (goodsNavigateList.size() <= 0) {
					goodsListResponse.setGoodNavigateImage("");
				} else {
					goodsListResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				}
				goodsListResponse.setLabelName(Goods.getLabelName());
				goodsListResponse.setGoodsName(Goods.getName());
				goodsListResponse.setSelfSupport(Goods.getSelfSupport());
				List<TeacherGoods> listTeacherGoods = teacherGoodsMapper.selectTeacherGoods(teacherId);
				for (TeacherGoods TeacherGoods : listTeacherGoods) {
					int a = 0;
					if (Goods.getId() != TeacherGoods.getGoodsId()) {
						a = 0;
					}
					if (Goods.getId() == TeacherGoods.getGoodsId()) {
						a = 1;
					}
					if (a == 1) {
						goodsListResponse.setIsShow(a);
					}
				}
				listGoodsListResponse.add(goodsListResponse);
			}
		}
		if (orderType == 2) {
			List<Goods> listGoods = goodsMapper.selectGoodsGoodsTypeAllDesc(page, pageSize);
			for (Goods Goods : listGoods) {
				GoodsListResponse goodsListResponse = new GoodsListResponse();
				goodsListResponse.setGoodId(Goods.getId());
				Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
				goodsListResponse.setBrandName(brand.getNameCn());
				goodsListResponse.setGoodId(Goods.getId());
				goodsListResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 7));
				goodsListResponse.setSuggestedPrice(Goods.getSuggestedPrice());
				List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
				if (goodsNavigateList.size() <= 0) {
					goodsListResponse.setGoodNavigateImage("");
				} else {
					goodsListResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				}
				goodsListResponse.setLabelName(Goods.getLabelName());
				goodsListResponse.setGoodsName(Goods.getName());
				goodsListResponse.setSelfSupport(Goods.getSelfSupport());
				List<TeacherGoods> listTeacherGoods = teacherGoodsMapper.selectTeacherGoods(teacherId);
				for (TeacherGoods TeacherGoods : listTeacherGoods) {
					int a = 0;
					if (Goods.getId() != TeacherGoods.getGoodsId()) {
						a = 0;
					}
					if (Goods.getId() == TeacherGoods.getGoodsId()) {
						a = 1;
					}
					if (a == 1) {
						goodsListResponse.setIsShow(a);
					}
				}
				listGoodsListResponse.add(goodsListResponse);
			}
		}
		return listGoodsListResponse;
	}

	@Override
	public int GoodsListResponseCount() {
		return goodsMapper.selectGoodsGoodsTypeAllCount();
	}

	@Override
	public List<GoodsListResponse> searchGoodsList(String labelName, long teacherId, int page, int pageSize) {
		List<GoodsListResponse> listGoodsListResponse = new ArrayList<GoodsListResponse>();
		List<Goods> listGoods = goodsMapper.selectGoodsSearch("%" + labelName + "%", page, pageSize);
		for (Goods Goods : listGoods) {
			GoodsListResponse goodsListResponse = new GoodsListResponse();
			goodsListResponse.setGoodId(Goods.getId());
			Brand brand = brandMapper.selectBrandById(Goods.getBrandId());
			goodsListResponse.setBrandName(brand.getNameCn());
			goodsListResponse.setGoodId(Goods.getId());
			goodsListResponse.setLowestPrice(goodsService.getLowestPrice(Goods, 0, 7));
			goodsListResponse.setSuggestedPrice(Goods.getSuggestedPrice());
			List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(Goods.getId());
			goodsListResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
			goodsListResponse.setLabelName(Goods.getLabelName());
			goodsListResponse.setGoodsName(Goods.getName());
			goodsListResponse.setSelfSupport(Goods.getSelfSupport());
			List<TeacherGoods> listTeacherGoods = teacherGoodsMapper.selectTeacherGoods(teacherId);
			for (TeacherGoods TeacherGoods : listTeacherGoods) {
				int a = 0;
				if (Goods.getId() != TeacherGoods.getGoodsId()) {
					a = 0;
				}
				if (Goods.getId() == TeacherGoods.getGoodsId()) {
					a = 1;
				}
				if (a == 1) {
					goodsListResponse.setIsShow(a);
				}
			}
			listGoodsListResponse.add(goodsListResponse);

		}
		return listGoodsListResponse;
	}

	@Override
	public int searchGoodsListCount(String labelName) {
		return goodsMapper.selectGoodsSearchCount("%" + labelName + "%");
	}

	@Override
	public List<GoodsListResponse> listNewGoods(long userId, int page, int pageSize) {
		List<GoodsListResponse> listGoodsListResponse = new ArrayList<GoodsListResponse>();
		List<Goods> listGoods = goodsMapper.selectListGoodsNew(page, pageSize);
		for (Goods goods : listGoods) {
			GoodsListResponse goodsListResponse = new GoodsListResponse();
			goodsListResponse.setGoodId(goods.getId());
			goodsListResponse.setLabelName(goods.getLabelName());
			goodsListResponse.setGoodsName(goods.getName());
			goodsListResponse.setName(goods.getName());
			int roleId = 0;
			User user = userMapper.selectByPrimaryKey(userId);
			if (user == null) {
				roleId = 1;
			}
			if (user != null) {
				roleId = user.getRoleId();
			}
			goodsListResponse.setLowestPrice(goodsService.getLowestPrice(goods, 0, roleId));
			goodsListResponse.setSuggestedPrice(goods.getSuggestedPrice());
			// GoodsDetail goodsDetail =
			// goodsDetailMapper.selectGoodsDetailById(Goods.getId());
			List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(goods.getId());
			goodsListResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
			Brand brand = brandMapper.selectBrandById(goods.getBrandId());
			goodsListResponse.setBrandName(brand.getNameCn());
			goodsListResponse.setSelfSupport(goods.getSelfSupport());
			listGoodsListResponse.add(goodsListResponse);
		}
		return listGoodsListResponse;
	}

	@Override
	public int listNewGoodsCount() {
		return 0;
	}

	@Override
	public void syncGoodsCToES() {
		logger.info("开始同步C区商品信息到ES");
		try {
			List<GoodsForES> goodsList = goodsMapper.selectAllGoodsType0ForES();
			if (goodsList != null && goodsList.size() > 0) {
				ESUtil.bulkUpdate(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_C, goodsList);
			}
			logger.info("同步C区商品信息到ES成功结束");
		} catch (IOException e) {
			logger.error("同步C区商品信息到ES出错", e);
		}
	}

	@Override
	public void syncGoodsBToES() {
		logger.info("开始同步B区商品信息到ES");
		try {
			List<GoodsForES> goodsList = goodsMapper.selectAllGoodsType1ForES();
			if (goodsList != null && goodsList.size() > 0) {
				ESUtil.bulkUpdate(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_B, goodsList);
			}
			logger.info("同步B区商品信息到ES成功结束");
		} catch (IOException e) {
			logger.error("同步B区商品信息到ES出错", e);
		}
	}

	@Override
	public void syncBrandToES() {
		logger.info("开始同步品牌信息到ES");
		try {
			List<BrandForES> brandList = brandMapper.selectAllBrandsForES();
			if (brandList != null && brandList.size() > 0) {
				ESUtil.bulkUpdate(ESConstant.ES_INDEX, ESConstant.ES_TYPE_BRAND, brandList);
			}
			logger.info("同步品牌信息到ES成功结束");
		} catch (IOException e) {
			logger.error("同步品牌信息到ES出错", e);
		}
	}

	@Override
	public int getLowestPrice(GoodsSimpleVo simpleGoods, int shareUserRoleId, int seeUserRoleId) {
		if (shareUserRoleId > 1 || seeUserRoleId > 1) {
			// 如果当前登录的用户是会员或更高角色，这里看到会员价
			return simpleGoods.getLowestPrice() * (100 - simpleGoods.getTalentLimit()) / 100;
		}
		return simpleGoods.getLowestPrice();
	}

	@Override
	public GoodsPrice getGoodsViewPriceForGoods(User user, long goodsid, long limitSaleTimeId) throws RuntimeException {

		Goods goods = goodsMapper.selectGoodsByIdTwo(goodsid);

		GoodsPrice goodsPrice = new GoodsPrice();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("productId", goodsid);
		map.put("limitTimeSaleId", limitSaleTimeId);
		List<LimitTimeSaleDetail> list = limitTimeSaleDetailMapper.selectLimitSaleById(map);
		if (list != null && list.size() > 0) {
			LimitTimeSaleDetail detail = list.get(0);
			goodsPrice.setMarketPirce(NumberUtil.getMoney(goods.getSuggestedPrice()));
			goodsPrice.setSalePrice(NumberUtil.getMoney(detail.getProductSalePrice()));
			goodsPrice.setXzb(detail.getProductSalePrice() / 100);
			goodsPrice.setProductId(Long.valueOf(detail.getSkuNo()));
			goodsPrice.setGoodsId(Long.valueOf(detail.getProductSn()));
			//GoodsCommission goodsCommission= goodsCommissionMapper.selectGoodsCommissionByGoodId(goodsid, user.getRoleId());

			//一定取分时抢购
			GoodsCommission goodsCommission = goodsCommissionMapper.selectLimitTimeSaleCommissionByGoodId(limitSaleTimeId, goodsid, user.getRoleId());

			if (goodsCommission == null) {
				goodsPrice.setCommission(BigDecimal.ZERO);
				goodsPrice.setNumber_commission(0);
			} else {
				if (goodsCommission.getCommissionType() == 1) {//按比例
					goodsPrice.setCommission(NumberUtil.getMoney((goodsCommission.getCommission() / 100.0) * detail.getProductSalePrice()));
					goodsPrice.setNumber_commission((goodsCommission.getCommission() / 100) * detail.getProductSalePrice());
				} else if (goodsCommission.getCommissionType() == 2) {//按金额
					goodsPrice.setCommission(NumberUtil.getMoney(goodsCommission.getCommission()));
					goodsPrice.setNumber_commission(goodsCommission.getCommission());
				}
			}

		}
		return goodsPrice;
	}

	@Override
	public GoodsPrice getGoodsViewPriceForGoods(User user, long goodsid) throws RuntimeException {
		//获取校妆姐姐的用户ID，是USER_ID，不是讲师编号，配置在base_restrictions表中
		int public_user_id = baseRestrictionsService.getBaseRestrictionsForCache("xz_jj").getExperience();
		if (user == null) {
			user = userService.getUserById(Long.valueOf(public_user_id));
		}
		GoodsPrice goodsPrice = new GoodsPrice();
		//未登录用户，该字段传NULL
		Goods goods = goodsMapper.selectGoodsByIdTwo(goodsid);
		if (goods == null) {
			return null;
		}
		List<Product> productList = productMapper.selectProductByGoodId(goodsid);
		Map<String, Object> map = null;
		List<Long[]> priceList = new ArrayList<Long[]>();
		Long[] _priceinfo = null; //销售价格，规格ID ，产品ID ， 分时抢购ID

		for (Product product : productList) {
			Integer _marketSalePrice = 0;
			_priceinfo = new Long[4];
			map = new HashMap<String, Object>();
			//先判断该规格商品（当前时间）是否存在分时抢购活动中，如果存在则忽略身份，直接显示抢购价
			map.put("sku_no", product.getId());
			map.put("current_time", new Date());
			LimitTimeSaleDetail limitTimeSaleDetail = limitTimeSaleDetailMapper.selectByProductId(map);
			//每个SKU商品在同一时段内，只能有一次抢购
			if (limitTimeSaleDetail != null) {
				_marketSalePrice = limitTimeSaleDetail.getProductSalePrice();
				//				t = Triple.of(_marketSalePrice, Long.valueOf(limitTimeSaleDetail.getSkuNo()), Long.valueOf(limitTimeSaleDetail.getProductSn()));
				_priceinfo[0] = Long.valueOf(_marketSalePrice);
				_priceinfo[1] = limitTimeSaleDetail.getSkuNo();
				_priceinfo[2] = limitTimeSaleDetail.getProductSn();
				_priceinfo[3] = Long.valueOf(limitTimeSaleDetail.getLimitTimeSaleId());
			} else {
				//先判断该规格商品是否存在分时抢购预热活动中，如果存在则忽略身份，直接显示抢购价
				map.put("sku_no", product.getId());
				map.put("queryEndDate", DateUtils.getDayStart(CommonConstants.PRELIMITSALEQUERYDAYS));
				LimitTimeSaleDetail preLimitTimeSaleDetail = limitTimeSaleDetailMapper.selectByProductId(map);
				if (preLimitTimeSaleDetail != null) {
					_marketSalePrice = preLimitTimeSaleDetail.getProductSalePrice();
					_priceinfo[0] = Long.valueOf(_marketSalePrice);
					_priceinfo[1] = preLimitTimeSaleDetail.getSkuNo();
					_priceinfo[2] = preLimitTimeSaleDetail.getProductSn();
					_priceinfo[3] = Long.valueOf(preLimitTimeSaleDetail.getLimitTimeSaleId());
				} else {
					Inventory inventory = inventoryMapper.selectAllInventoryByProductId(product.getId());
					if (inventory == null) {
						logger.error(product.getId() + "货号缺少库存记录");
						throw new RuntimeException(product.getId() + " 商品缺少库存记录！ ");
					}
					if (user.getId() == public_user_id) {//当前登录人的推荐人为： 校妆姐姐，所以取校妆姐姐价
						_marketSalePrice = inventory.getXzSalePrice();

						_priceinfo[0] = Long.valueOf(_marketSalePrice);
						_priceinfo[1] = product.getId();
						_priceinfo[2] = product.getGoodId();
						_priceinfo[3] = null;

					} else {//当前登录人的推荐人为： 一般店主，所以取店主价
						_marketSalePrice = inventory.getSalePrice();

						_priceinfo[0] = Long.valueOf(_marketSalePrice);
						_priceinfo[1] = product.getId();
						_priceinfo[2] = product.getGoodId();
						_priceinfo[3] = null;
					}
				}
			}
			//轮循取最小值进行
			if (CollectionUtils.isEmpty(priceList)) {
				priceList.add(_priceinfo);
			} else {
				Long existPrice = priceList.get(0)[0];
				if (_priceinfo[0] != null && existPrice != null) {
					if (_priceinfo[0].longValue() < existPrice.longValue()) {
						priceList.remove(0);
						priceList.add(_priceinfo);
					}
				}
			}

		}
		int price = 0;
		if (priceList != null && priceList.size() > 0) {
			Long[] _minPrice = priceList.get(0);

			//			goodsPrice.setSalePrice(NumberUtil.divBigDecimal(priceList.get(0).getLeft(), NumberUtil.MONEY_RADIO, 2));
			goodsPrice.setSalePrice(NumberUtil.getMoney(_minPrice[0]));
			goodsPrice.setNumber_salePrice((int) _minPrice[0].longValue());
			goodsPrice.setProductId(_minPrice[1]);
			goodsPrice.setGoodsId(_minPrice[2]);
			price = (int) _minPrice[0].longValue();
		} else {
			//			throw  new RuntimeException("该商品下面没有任何规格产品");
			return null;
		}

		//读取
		GoodsCommission goodsCommission = null;

		if (priceList.get(0)[3] == null) {//非分时抢购
			goodsCommission = goodsCommissionMapper.selectGoodsCommissionByGoodId(goodsid, user.getRoleId());
		} else {
			goodsCommission = goodsCommissionMapper.selectLimitTimeSaleCommissionByGoodId(priceList.get(0)[3], goodsid, user.getRoleId());
		}
		if (goodsCommission == null) {
			goodsPrice.setCommission(BigDecimal.ZERO);
			goodsPrice.setNumber_commission(0);
		} else {
			if (goodsCommission.getCommissionType() == 1) {//按比例
				goodsPrice.setCommission(NumberUtil.getMoney((goodsCommission.getCommission() / 100.0) * price));
				goodsPrice.setNumber_commission((goodsCommission.getCommission() / 100) * price);
			} else if (goodsCommission.getCommissionType() == 2) {//按金额
				goodsPrice.setCommission(NumberUtil.getMoney((goodsCommission.getCommission())));
				goodsPrice.setNumber_commission(goodsCommission.getCommission());

			}
		}

		//goodsPrice.setMarketPirce(NumberUtil.divBigDecimal(goods.getSuggestedPrice(), NumberUtil.MONEY_RADIO, 2));
		goodsPrice.setMarketPirce(NumberUtil.getMoney(goods.getSuggestedPrice()));
		goodsPrice.setNumber_marketPirce(goods.getSuggestedPrice());
		goodsPrice.setXzb((((int) priceList.get(0)[0].longValue()) * goods.getScoreRate()) / 100);//妆币取整，不进行四舍五入

		return goodsPrice;
	}

	/***
	 * 
	 * 获取产品在APP上面的显示价格 : 按PRODUCT_ID 区分用户，产品状态： 如，同一产品在抢购时段和正常时段的价格是不一样的。
	 * @return zyf
	 * 
	 */
	@Override
	public GoodsPrice getGoodsViewPriceForProduct(User user, long productId) throws RuntimeException {
		// 获取校妆姐姐的用户ID，是USER_ID，不是讲师编号，配置在base_restrictions表中
		int public_user_id = baseRestrictionsService.getBaseRestrictionsForCache("xz_jj").getExperience();
		if (user == null) {
			//user = userMapper.selectByPrimaryKey(Long.valueOf(public_user_id));
			user = userService.getUserById(Long.valueOf(public_user_id));
		}
		Product product = productMapper.selectProductByIdNoStatus(productId);
		GoodsPrice goodsPrice = new GoodsPrice();
		Integer _marketSalePrice = 0;
		Map<String, Object> map = new HashMap<String, Object>();
		// 先判断该规格商品（当前时间）是否存在分时抢购活动中，如果存在则忽略身份，直接显示抢购价
		map.put("sku_no", productId);
		map.put("current_time", new Date());
		LimitTimeSaleDetail limitTimeSaleDetail = limitTimeSaleDetailMapper.selectByProductId(map);
		// 每个SKU商品在同一时段内，只能有一次抢购
		if (limitTimeSaleDetail != null) {
			//LimitTimeSaleDetail limitTimeSaleDetail = list.get(0);
			_marketSalePrice = limitTimeSaleDetail.getProductSalePrice();
			//设置分时抢购ID
			goodsPrice.setLimitTimeSaleId(limitTimeSaleDetail.getLimitTimeSaleId());
		} else {
			//查询是否有预热的分时抢购信息
			map.put("queryEndDate", DateUtils.getDayStart(CommonConstants.PRELIMITSALEQUERYDAYS));
			limitTimeSaleDetail = limitTimeSaleDetailMapper.selectByProductId(map);
			if (limitTimeSaleDetail != null) {
				//LimitTimeSaleDetail limitTimeSaleDetail = list.get(0);
				_marketSalePrice = limitTimeSaleDetail.getProductSalePrice();
				//设置分时抢购ID
				goodsPrice.setLimitTimeSaleId(limitTimeSaleDetail.getLimitTimeSaleId());
			} else {
				Inventory inventory = inventoryMapper.selectAllInventoryByProductId(productId);
				if (inventory == null) {
					logger.error(productId + "货号缺少库存记录");
					throw new RuntimeException(productId + " 商品缺少库存记录！ ");
				}
				if (user.getId() == public_user_id) {// 当前登录人的推荐人为： 校妆姐姐，所以取校妆姐姐价
					_marketSalePrice = inventory.getXzSalePrice();
				} else {// 当前登录人的推荐人为： 一般店主，所以取店主价
					_marketSalePrice = inventory.getSalePrice();
				}
			}
		}
		// 读取

		GoodsCommission goodsCommission = null;
		if (limitTimeSaleDetail != null) {
			goodsCommission = goodsCommissionMapper.selectLimitTimeSaleCommissionByGoodId(goodsPrice.getLimitTimeSaleId(), product.getGoodId(), user.getRoleId());
		} else {
			goodsCommission = goodsCommissionMapper.selectGoodsCommissionByGoodId(product.getGoodId(), user.getRoleId());
		}

		goodsPrice.setProductId(product.getId());
		goodsPrice.setGoodsId(product.getGoodId());
		goodsPrice.setSalePrice(NumberUtil.getMoney(_marketSalePrice));
		goodsPrice.setNumber_salePrice(_marketSalePrice);
		Goods goods = goodsMapper.selectGoodsByIdTwo(product.getGoodId());
		if (goods == null) {
			//			throw new RuntimeException(product.getGoodId() + " 商品不存在，请检查商品是否下架！ ");
			return null;
		}

		if (goodsCommission == null) {
			goodsPrice.setCommission(BigDecimal.ZERO);
			goodsPrice.setNumber_commission(0);
		} else {
			if (goodsCommission.getCommissionType() == 1) {//按比例
				goodsPrice.setCommission(NumberUtil.getMoney((goodsCommission.getCommission() / 100.0) * _marketSalePrice));
				goodsPrice.setNumber_commission((goodsCommission.getCommission() / 100) * _marketSalePrice);

			} else if (goodsCommission.getCommissionType() == 2) {//按金额
				goodsPrice.setCommission(NumberUtil.getMoney(goodsCommission.getCommission()));
				goodsPrice.setNumber_commission(goodsCommission.getCommission());
			}
		}
		goodsPrice.setMarketPirce(NumberUtil.getMoney(goods.getSuggestedPrice()));
		goodsPrice.setNumber_marketPirce(goods.getSuggestedPrice());
		goodsPrice.setXzb((_marketSalePrice * goods.getScoreRate()) / 100);
		return goodsPrice;

	}

	@Override
	public GoodsVo getGoodsInfoById(long goodsId, Long productId, int limitTimeSaleId, long userId, Integer storeUserId, String from) {
		GoodsVo goodsVo = this.selectGoodsInfoById(goodsId, productId, limitTimeSaleId, storeUserId);
		//如果from不为空  需要累计被分享后打开次数
		if (goodsVo != null) {
			if (!StringUtils.isEmpty(from)) {
				this.goodsMapper.saveOpenAndShareCount(Integer.valueOf(goodsId + ""), 1, 0);
				// from不为空说明是分享被打开的链接
				goodsVo.setShareUserId(userId == 0l ? null : userId);// 商品分享人ID
			} else {
				goodsVo.setShareUserId(null);// 商品分享人ID
			}
		}
		return goodsVo;
	}

	/**
	 * 
	 * **********************************************
	 * @Title: selectGoodsInfoById
	 * @Description: 获取产品信息
	 * @param @param goodsId
	 * @param @param shareUserRoleId
	 * @param @param roleId
	 * @param @param storeUserId
	 * @param @return 设定文件
	 * @return GoodsVo 返回类型
	 * @throws 异常
	 * @author NingChongQing 作者
	 * @date 2017年7月13日 下午5:52:17 时间 **********************************************
	 */
	public GoodsVo selectGoodsInfoById(long goodsId, Long productId, int limitTimeSaleId, Integer storeUserId) {
		Goods goods = this.goodsMapper.selectGoodsByIdTwo(goodsId);
		if (goods == null) {
			return null;
		}
		//获取额外属性
		goods.LoadExtends(LoadGoodsExtends(goods));
		// 商品不为空，开始给商品的更多属性赋值
		GoodsVo vo = new GoodsVo(goods);
		Brand brand = this.brandMapper.selectBrandById(goods.getBrandId());
		// 品牌为空返回更多品牌
		if (brand == null) {
			brand = this.brandMapper.selectBrandById(85);
		}
		//设置品牌信息
		vo.setBrand(brand);
		vo.setLowestPrice(0);
		//设置海外购信息
		if (goods.getOverseasGoods() == 1) {
			OverseasGoodsLable overseasGoodsLable = overseasGoodsLableMapper.selectOverseasGoodsLableByGoodsID(goods.getId());
			if (overseasGoodsLable == null) {
				logger.error("海外购商品没有标签明细: goodsid:{}", goods.getId());
				overseasGoodsLable = overseasGoodsLableMapper.selectDefaultOverseasGoodsLable();
			}
			vo.setOverseasGoodsLable(overseasGoodsLable);
		}
		// 商品介绍图
		List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(goodsId);
		vo.setGoodNavigateList(goodsNavigateList);
		// 微信小图
		if (goodsNavigateList != null && goodsNavigateList.size() > 0) {
			vo.setWxSmallImgpath(goodsNavigateList.get(0).getNavigateImage());
		} else {
			vo.setWxSmallImgpath("");
		}
		// 详情图
		List<GoodsDetail> goodsDetailList = goodsDetailMapper.selectGoodsDetailByGoodId(vo.getId(), GoodsImgType.ALL.getType());
		List<GoodsDetail> detailsList = new ArrayList<GoodsDetail>();
		List<GoodsDetail> specList = new ArrayList<GoodsDetail>();
		List<GoodsDetail> noticesList = new ArrayList<GoodsDetail>();
		for (GoodsDetail goodsDetail : goodsDetailList) {
			//详情
			if (goodsDetail.getImgType() == GoodsImgType.DETAIL.getType()) {
				detailsList.add(goodsDetail);
			} else if (goodsDetail.getImgType() == GoodsImgType.SPEC.getType()) {
				specList.add(goodsDetail);
			} else if (goodsDetail.getImgType() == GoodsImgType.NOTICE.getType()) {
				noticesList.add(goodsDetail);
			}
		}
		vo.setGoodDetailList(detailsList);
		vo.setGoodSpecImgList(specList);
		vo.setGoodsNoticeImgList(noticesList);
		// 商品服务项目
		vo.setGoodsServiceList(settingGoodsServiceList(goods));
		List<SpecDesc> specDescList = JSON.parseArray(goods.getSpecDesc(), SpecDesc.class);
		vo.setSpecDescList(specDescList);
		vo.setGoodsCommission(null);
		// 商品推荐数
		vo.setRecommendNum(shareGoodsMapper.selectShareGoodByGoodIdCount(vo.getId()));
		// 商品评论数
		vo.setCommentNum(goodsCommentMapper.selectGoodsCommentByGoodIdCount(vo.getId()));
		// 分享商品可增加的颜值数字
		vo.setShareYanzhi(baseRestrictionsMapper.selectExperienceForShareGoods());
		User user = this.userMapper.selectByPrimaryKey(Long.valueOf(storeUserId));
		GoodsPrice goodsPrice = null;
		if (productId.intValue() != 0) {
			goodsPrice = this.getGoodsViewPriceForProduct(user, productId);
		} else {
			goodsPrice = this.getGoodsViewPriceForGoods(user, vo.getId());
			productId = goodsPrice.getProductId();
		}
		if (goods.getCommision() == 0) {//不可以设置佣金
			goodsPrice.setCommission(BigDecimal.ZERO);
		}
		//商品标签
		List<Map<String, String>> labelArray = new ArrayList<Map<String, String>>();
		// 状态（SecKill:秒杀中;NormalSale:原价销售;PreHeat:预热中;UnderCarriage:下架了）
		// 原价销售：没有参与分时抢购活动，且未被下架。--默认	
		// 预热中：分时抢购活动，且服务器当前时间小于秒杀活动开始时间；	 
		// 秒杀中：分时抢购活动，且服务器当前时间大于秒杀活动开始时间，小于秒杀活动结束时间；	
		// 抢光：分时抢购活动，且APP实际库存与分时抢购活动设置的库存中的最小的一个数量小于等于0；	
		// 下架：商品下架时间小于服务器当前时间或者下架时间字段为空值；	
		String saleStatus = "NormalSale";// 默认原价销售状态
		String nowTime = DateUtil.currentStringDate();
		// 查询是否存在分时抢购活动
		Map<String, Object> ltsMap = this.goodsMapper.selectNearlyLimitTimeSale(vo.getId(), productId, nowTime);
		if (ltsMap != null) {
			if (limitTimeSaleId == 0) {
				limitTimeSaleId = Integer.parseInt(ltsMap.get("id").toString());
			}
			Map<String, String> tmLabel = new HashMap<String, String>();
			// 分时抢购开始时间
			try {
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				// 活动开始时间
				Date fullBeginTime = sdf.parse(ltsMap.get("fullBeginTime").toString());
				// 系统当前时间
				long nowTimeMillis = System.currentTimeMillis();
				if (fullBeginTime.getTime() > nowTimeMillis) {// 预热中
					saleStatus = "PreHeat";
					tmLabel.put("label", "预热");
				} else {// 抢购中
					saleStatus = "SecKill";
					tmLabel.put("label", "特卖");
				}
			} catch (ParseException e) {

			}
			tmLabel.put("color", "#ff4b7a");
			labelArray.add(tmLabel);
			ltsMap.put("productSalePrice", NumberUtil.getMoney(Long.parseLong(ltsMap.get("productSalePrice").toString())) + "");
		}
		// 实时库存
		Long realTimeInventory = 0L;
		// 分时抢购ID不为0  
		if (limitTimeSaleId != 0) {
			Map<Integer, Set<Long>> limitSaleGoodsIdMap = new HashMap<>();//分时抢购商品集合
			Set<Long> goodsIdSet = new HashSet<Long>();//商品id集合
			goodsIdSet.add(vo.getGoodId());
			limitSaleGoodsIdMap.put(limitTimeSaleId, goodsIdSet);
			LimitSaleGoodsInventroy limitSaleGoodsInventroy = this.inventoryService.findDynaByGoodsId(limitSaleGoodsIdMap);
			realTimeInventory = (long) limitSaleGoodsInventroy.getNums(limitTimeSaleId, vo.getGoodId());
		} else {
			realTimeInventory = this.inventoryService.findDynaByGoodsId(goods.getId());
		}
		// 下架了
		if (vo.getOnlineTime() == null || vo.getOfflineTime() == null || (DateUtil.betweenTime(vo.getOnlineTime(), vo.getOfflineTime()) < 1)) {
			saleStatus = "UnderCarriage";
		}
		// C区商品  设置为已下架状态
		if (goods.getGoodsType() == 0) {
			saleStatus = "UnderCarriage";
		}
		vo.setSaleStatus(saleStatus);// 销售状态
		vo.setGoodsPrice(goodsPrice);// 价格信息
		vo.setInventoryNum(realTimeInventory.intValue());// 库存数
		vo.setSalerNums(vo.getUpCount());//在售人数
		vo.setLtsMap(ltsMap);// 分时抢购信息
		vo.setLabelArray(labelArray);// 标签信息
		// 活动信息
		/***
		 * 调用公告接口获取活动信息
		 */
		List<Map<String, Object>> activitiesList = new ArrayList<Map<String, Object>>();
		OActivitiesInfo oActivitiesInfo = this.oActivService.getOActivitiesInfo(goodsId, 0L);
		if (oActivitiesInfo != null) {
			if (!CollectionUtils.isEmpty(oActivitiesInfo.getoActivContentExpressList())) {
				for (OActivContentExpress oace : oActivitiesInfo.getoActivContentExpressList()) {
					Map<String, Object> oaMap = new HashMap<String, Object>();
					oaMap.put("tag", oace.getTagName());
					oaMap.put("slogan", oace.getActivTitle());
					oaMap.put("type", 1);
					oaMap.put("number", 1);
					activitiesList.add(oaMap);
				}
			}
			if (!CollectionUtils.isEmpty(oActivitiesInfo.getoActivContentMoneyList())) {
				Map<String, Object> oaMap = new HashMap<String, Object>();
				String oacmTage = "";
				String oacmSlogan = "";
				for (OActivContentMoney oacm : oActivitiesInfo.getoActivContentMoneyList()) {
					if (StringUtils.isEmpty(oacmTage)) {
						oacmTage = oacm.getTagName();
					}
					oacmSlogan = oacmSlogan + oacm.getActivTitle() + ";";
				}
				oaMap.put("tag", oacmTage);
				oaMap.put("slogan", oacmSlogan);
				oaMap.put("type", 0);
				oaMap.put("number", 1);
				activitiesList.add(oaMap);
			}
			if (!CollectionUtils.isEmpty(oActivitiesInfo.getoActivGiftProductList())) {
				for (OActivGiftProduct oagf : oActivitiesInfo.getoActivGiftProductList()) {
					Map<String, Object> oaMap = new HashMap<String, Object>();
					oaMap.put("tag", oagf.getTagName());
					oaMap.put("slogan", oagf.getActivTitle());
					oaMap.put("type", 2);
					oaMap.put("number", oagf.getGiftNum());
					activitiesList.add(oaMap);
				}
			}
		}
		vo.setActivities(activitiesList);
		/** 素材信息 */
		Map<String, Object> materials = new HashMap<String, Object>();
		List<Map<String, Object>> materialsList = this.goodsMapper.selectMaterialsByGoodsId(goodsId);
		int count = 0;
		Map<String, Object> detail = new HashMap<String, Object>();
		if (CollectionUtils.isEmpty(materialsList)) {
			detail.put("title", "");
			detail.put("images", new ArrayList<Map<String, Object>>());
		} else {
			count = materialsList.size();
			detail.put("title", materialsList.get(0).get("context").toString().replaceAll("<[^>]+>", ""));
			detail.put("images", this.goodsMapper.selectTitleDiscoverPicturesByTitleId(Integer.parseInt(materialsList.get(0).get("id").toString())));
		}
		materials.put("count", count);
		materials.put("detail", detail);
		vo.setMaterials(materials);
		return vo;
	}

	@Override
	public GoodSerialVo selectOneGoodById(long id) {
		return goodsMapper.selectOneGoodById(id);
	}

	@Override
	public List<ProductTag> getGoodsTag(Long goodsid, Long productId) {
		String nowTime = DateUtil.currentStringDate();
		Map<String, Object> map = goodsMapper.selectLimitTimeSale(goodsid, productId, nowTime);
		List<ProductTag> productTagList = new ArrayList<>();
		if (map != null) {
			productTagList.add(new ProductTag());
		}
		return productTagList;
	}

	@Override
	public GoodsPrice getLimitTimeSalePrice(User user, Long pid, Integer limie_sale_id, int type) throws Exception {
		GoodsPrice goodsPrice = new GoodsPrice();
		Map<String, Object> map = null;
		if (type == 1) {//按GOODSID 
			Goods goods = goodsMapper.selectGoodsByIdTwo(pid);
			map = new HashMap<String, Object>();
			map.put("productId", pid);
			map.put("limitTimeSaleId", limie_sale_id);
			List<LimitTimeSaleDetail> list = limitTimeSaleDetailMapper.selectLimitSaleById(map);
			List<Triple<Integer, Long, Long>> priceList = new ArrayList<Triple<Integer, Long, Long>>();
			for (LimitTimeSaleDetail p : list) {
				Triple<Integer, Long, Long> t;
				//				Product product = productMapper.selectProductByIdNoStatus(Long.valueOf(p.getSkuNo()));
				t = Triple.of(p.getProductSalePrice(), Long.valueOf(p.getSkuNo()), Long.valueOf(p.getProductSn()));
				priceList.add(t);
			}
			if (priceList != null && priceList.size() > 0) {
				Collections.sort(priceList);
				GoodsCommission goodsCommission = goodsCommissionMapper.selectGoodsCommissionByGoodId(priceList.get(0).getRight(), user.getRoleId());
				if (goodsCommission != null) {
					goodsPrice.setCommission(NumberUtil.getMoney((goodsCommission.getCommission() / 100.0) * priceList.get(0).getLeft()));
				}
				goodsPrice.setSalePrice(NumberUtil.getMoney(priceList.get(0).getLeft()));
				goodsPrice.setMarketPirce(NumberUtil.getMoney(goods.getSuggestedPrice()));
				goodsPrice.setXzb((priceList.get(0).getLeft()) / 100);
				goodsPrice.setProductId(priceList.get(0).getMiddle());
				goodsPrice.setGoodsId(pid);
			} else {
				return goodsPrice;
			}
		} else if (type == 2) {//按PRODUCTID ，按需求只会有一条结果
			map = new HashMap<String, Object>();
			map.put("skuNo", pid);
			map.put("limitTimeSaleId", limie_sale_id);
			List<LimitTimeSaleDetail> list = limitTimeSaleDetailMapper.selectLimitSaleById(map);
			if (list == null || list.size() == 0) {
				return goodsPrice;
			}
			if (list.size() > 1) {//报错， 需求是： 同一个时间段内，不能出现两个相同产品的分时抢购
				logger.error("数据错误----" + limie_sale_id + "这个分时抢购批次内有" + list.size() + "条产品记录 SKU_NO ： " + pid);
				throw new Exception("数据错误----" + limie_sale_id + "这个分时抢购批次内有" + list.size() + "条产品记录 SKU_NO ： " + pid);
			}
			Product product = productMapper.selectProductById(pid);
			Goods goods = goodsMapper.selectGoodsByIdTwo(product.getGoodId());
			Integer salePrice = list.get(0).getProductSalePrice();

			// 读取
			GoodsCommission goodsCommission = goodsCommissionMapper.selectGoodsCommissionByGoodId(product.getGoodId(), user.getRoleId());
			if (goodsCommission != null) {
				goodsPrice.setCommission(NumberUtil.getMoney((goodsCommission.getCommission() / 100.0) * salePrice));
			}
			goodsPrice.setSalePrice(NumberUtil.getMoney(salePrice));
			goodsPrice.setMarketPirce(NumberUtil.getMoney(goods.getSuggestedPrice()));
			goodsPrice.setXzb(salePrice / 100);
			goodsPrice.setProductId(pid);
			goodsPrice.setGoodsId(goods.getId());
		}

		return goodsPrice;
	}

	/**
	 * es全局搜索
	 */
	@Override
	public List<GoodsESVo> esGlobalSearchGoods(Integer storeUserId, String searchKeyWord, int startIndex, Integer pageSize, User loginuser) throws Exception {
		List<GoodsESVo> goodsESVoList = new ArrayList<GoodsESVo>();
		List<String> jsonStrList = ESUtil.searchGoods(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_B, startIndex, pageSize, searchKeyWord);
		BaseRestrictions baseRestrictions = baseRestrictionsService.getBaseRestrictionsForCache("GOODS_BLACKLIST");
		if (jsonStrList != null && jsonStrList.size() > 0) {
			User user = this.userMapper.selectByPrimaryKey(Long.valueOf(storeUserId));
			for (String jsonStr : jsonStrList) {
				if (!StringUtils.isEmpty(jsonStr)) {
					//					ObjectMapper mapper = new ObjectMapper();
					//					JSONObject jsonObject = mapper.readValue(jsonStr, JSONObject.class);
					JSONObject jsonObject = JSONObject.parseObject(jsonStr);
					if (jsonObject != null) {
						long goodsId = jsonObject.getLongValue("id");
						Goods goods = goodsMapper.selectGoodsById(goodsId);
						if (goods != null) {
							if (loginuser == null || loginuser.getRoleId() < 3) {
								if (baseRestrictions != null && !StringUtils.isEmpty(baseRestrictions.getName())) {
									String _blacklist_str[] = baseRestrictions.getName().split(",");
									if (_blacklist_str != null && _blacklist_str.length > 0) {
										List<String> _blanklist = Arrays.asList(_blacklist_str);
										if (_blanklist.contains(String.valueOf(goods.getId()))) {
											continue;
										}
									}
								}
							}
							GoodsPrice goodsPrice = this.getGoodsViewPriceForGoods(user, goodsId);
							GoodsESVo vo = new GoodsESVo();
							vo.setGoodId(goodsId);
							vo.setName(jsonObject.getString("name"));
							vo.setLabelName(jsonObject.getString("labelName"));
							vo.setLowestPrice(goodsPrice.getSalePrice());// 
							vo.setSuggestedPrice(goodsPrice.getMarketPirce());
							vo.setGoodNavigateImage(getGoodsPicture(goodsId));
							vo.setGoodsType(jsonObject.getIntValue("goodsType"));
							vo.setSelfSupport(jsonObject.getIntValue("selfSupport"));
							// 过滤掉非B区商品
							if (jsonObject.getIntValue("goodsType") == 1) {
								goodsESVoList.add(vo);
							}
						}
					}
				}
			}
		}
		// 添加或更新搜索词汇
		List<GoodsSearchWord> searchWords = goodsSearchWordMapper.selectGoodsSearchWordBySearchWord(searchKeyWord);
		if (searchWords != null && searchWords.size() > 0) {
			goodsSearchWordMapper.updateGoodsSearchWordNumBySearchWord(searchKeyWord);
		} else {
			goodsSearchWordMapper.insertGoodsSearchWord(searchKeyWord);
		}
		return goodsESVoList;
	}

	@Override
	public Map<Long, GoodsPrice> getGoodsViewPriceForGoods(User user, List<Long> goodsIds) {
		// List<GoodsPrice> resultList = new ArrayList<GoodsPrice>();
		Map<Long, GoodsPrice> resultMap = new HashMap<Long, GoodsPrice>();
		int public_user_id = baseRestrictionsService.getBaseRestrictionsForCache("xz_jj").getExperience();
		if (user == null) {
			//user = userMapper.selectByPrimaryKey(Long.valueOf(public_user_id));
			user = userService.getUserById(Long.valueOf(public_user_id));
		}

		List<Inventory> _inventoryList = goodsMapper.selectPriceForGoods(goodsIds, user.getRoleId());
		List<LimitTimeSaleDetail> _limitTimeSaleDetailList = goodsMapper.selectLimitSalePriceList(goodsIds);
		List<Long[]> all_list = new ArrayList<Long[]>();
		for (Inventory inv : _inventoryList) {
			Long[] productInfo = new Long[7];
			Long goods_id = inv.getGoodId();
			Long product_id = inv.getProductId();
			Long price = Long.valueOf(inv.getSalePrice());
			Long xzjj_price = Long.valueOf(inv.getXzSalePrice());
			// Long comm = Long.valueOf(inv.getSettlementRateDealer()); //这个字段sql
			// MAPPER里面用别名把分佣表里面的分佣比例返回到这个字段上面了
			Long marketPrice = Long.valueOf(inv.getSettlementPrice()); // sql MAPPER里面用别名把GOODS表里面的市场价返回到这个字段上面了
			Long score_rate = Long.valueOf(inv.getSettlementRateManager()); // 产品表中的 校妆币比例
			Long _limit_sale_price = null;
			Long _limit_sale_id = 0l;
			for (LimitTimeSaleDetail detail : _limitTimeSaleDetailList) {
				long limit_time_product_id = Long.valueOf(detail.getSkuNo());
				if (product_id == limit_time_product_id) {
					// 相个PRODUCT_ID 相等 , 说明该PRODUCT_ID
					_limit_sale_price = Long.valueOf(detail.getProductSalePrice());
					_limit_sale_id = Long.valueOf(detail.getLimitTimeSaleId());
				}
			}

			// ==================================基于，同一个SKU产品，在当时时间点只能有一个分时抢购明细行 ，下面进行最小金额判断
			productInfo[0] = goods_id;
			productInfo[1] = product_id;
			productInfo[2] = marketPrice;
			productInfo[3] = 0l;
			productInfo[4] = _limit_sale_id;
			if (_limit_sale_price != null) {
				productInfo[5] = _limit_sale_price;
			} else {
				/**
				 * 查询预热sku商品
				 */
				List<LimitTimeSaleDetail> _prelimitTimeSaleDetailList = goodsMapper.selectLimitSalePriceListByGidsAndEndDate(goodsIds, DateUtils.getDayStart(CommonConstants.PRELIMITSALEQUERYDAYS));
				Long _prelimit_sale_price = null;
				Long _prelimit_sale_id = 0l;
				for (LimitTimeSaleDetail detail : _prelimitTimeSaleDetailList) {
					long limit_time_product_id = Long.valueOf(detail.getSkuNo());
					if (product_id == limit_time_product_id) {
						// 相个PRODUCT_ID 相等 , 说明该PRODUCT_ID
						_prelimit_sale_price = Long.valueOf(detail.getProductSalePrice());
						_prelimit_sale_id = Long.valueOf(detail.getLimitTimeSaleId());
					}
				}
				if (_prelimit_sale_price != null) {
					productInfo[5] = _prelimit_sale_price;
					productInfo[4] = _prelimit_sale_id;
				} else {
					if (user.getId() == public_user_id) {
						productInfo[5] = xzjj_price;
					} else {
						productInfo[5] = price;
					}
				}
			}
			productInfo[6] = score_rate;
			all_list.add(productInfo);
		}
		// 去重 : 去除同一个PRODUCTID ，取当前应该的销售价最小值的一行
		// ======================================================================
		Map<Long, Long[]> _map = new HashMap<Long, Long[]>();
		for (Long[] info : all_list) {
			long _currPrice = info[5];
			// long _prePrice = 0;
			// if(_map.size() > 0) {
			// for(Map.Entry<Long, Long[]> hmap :_map.entrySet()){
			// Long[] hinfo = (Long[])hmap.getValue();
			// _prePrice
			// }
			// }

			if (_map.get(info[0]) == null) {
				_map.put(info[0], info);
			} else {
				if (_map.get(info[0])[5] > _currPrice) {
					_map.put(info[0], info);
				}
			}
		}
		// ***********************************************************************
		// resultList
		// 封装
		GoodsPrice goodsPrice;
		for (Map.Entry<Long, Long[]> o : _map.entrySet()) {
			goodsPrice = new GoodsPrice();
			// String key = o.getKey().toString();
			// String value = o.getValue().toString();
			Long[] pinfo = o.getValue();

			GoodsCommission commission = null;
			long _marketprice = pinfo[2]; //
			long _goods_id = pinfo[0];
			long _product_id = pinfo[1];
			Long _limit_sale_id = pinfo[4];
			long _sale_price = pinfo[5];
			long _score_rate = pinfo[6];
			//
			if (_limit_sale_id != null && _limit_sale_id > 0) {//分时抢购ID不为空 ， 说明是分时抢
				commission = goodsCommissionMapper.selectLimitTimeSaleCommissionByGoodId(_limit_sale_id, _goods_id, user.getRoleId());
			} else {//不是分时抢购
				commission = goodsCommissionMapper.selectGoodsCommissionByGoodId(_goods_id, user.getRoleId());
			}

			// 赋值
			goodsPrice.setProductId(_product_id);
			goodsPrice.setGoodsId(_goods_id);
			goodsPrice.setMarketPirce(NumberUtil.getMoney(_marketprice));
			goodsPrice.setSalePrice(NumberUtil.getMoney(_sale_price));
			if (commission != null) {
				//1 比例  2 金额
				if (commission.getCommissionType() == 1) {
					goodsPrice.setCommission(NumberUtil.getMoney(_sale_price * (commission.getCommission() / 100.0)));
				} else if (commission.getCommissionType() == 2) {
					goodsPrice.setCommission(NumberUtil.getMoney(commission.getCommission()));
				}
			}

			goodsPrice.setXzb((int) ((_sale_price * _score_rate) / 100));
			if (_limit_sale_id > 0) {
				goodsPrice.setLimitTimeSaleId(_limit_sale_id);
			}
			// resultList.add(goodsPrice);
			resultMap.put(_goods_id, goodsPrice);
		}
		return resultMap;
	}

	@Override
	public Map<Long, GoodsPrice> getGoodsViewPriceForGoodsLimitTimeSale(User user, int limitTimeSaleId, Collection<Long> goodsIds) {
		Map<Long, GoodsPrice> resultMap = new HashMap<Long, GoodsPrice>();
		List<LimitTimeGoodsPrice> goodsPriceList = goodsMapper.selectLimitTimeSalePrice(goodsIds, user.getRoleId(), limitTimeSaleId);
		//		int public_user_id = baseRestrictionsService.getBaseRestrictionsForCache("xz_jj").getExperience();
		Map<Long, LimitTimeGoodsPrice> _map = new HashMap<Long, LimitTimeGoodsPrice>();
		for (LimitTimeGoodsPrice p : goodsPriceList) {
			if (_map.get(p.getGoodId()) == null) {
				_map.put(p.getGoodId(), p);
			} else {
				if (p.getProductSalePrice() < _map.get(p.getGoodId()).getProductSalePrice()) {
					_map.put(p.getGoodId(), p);
				}
			}
		}

		GoodsPrice goodsPrice;
		for (Map.Entry<Long, LimitTimeGoodsPrice> o : _map.entrySet()) {
			LimitTimeGoodsPrice vo = o.getValue();
			goodsPrice = new GoodsPrice();
			long _commission = vo.getCommission(); // 佣金比例
			long _marketprice = vo.getSuggestedPrice(); //
			long _goods_id = vo.getGoodId();
			long _product_id = vo.getProductId();
			int _limit_sale_id = limitTimeSaleId;
			long _sale_price = vo.getProductSalePrice();
			long _score_rate = vo.getScoreRate();

			goodsPrice.setProductId(_product_id);
			goodsPrice.setGoodsId(_goods_id);
			goodsPrice.setMarketPirce(NumberUtil.getMoney(_marketprice));
			goodsPrice.setSalePrice(NumberUtil.getMoney(_sale_price));
			//1 比例  2 金额
			if (vo.getCommissionType() == 1) {
				goodsPrice.setCommission(NumberUtil.getMoney(_sale_price * (_commission / 100.0)));
			} else if (vo.getCommissionType() == 2) {
				goodsPrice.setCommission(NumberUtil.getMoney(_commission));
			}
			goodsPrice.setXzb((int) ((_sale_price * _score_rate) / 100));
			if (_limit_sale_id > 0) {
				goodsPrice.setLimitTimeSaleId(_limit_sale_id);
			}
			resultMap.put(_goods_id, goodsPrice);

		}
		return resultMap;
	}

	@Override
	public ResponseEntity<?> listGoodsPageByBrandIdNew(GoodsRequest request) {
		// 店主用户ID  默认是校妆姐姐店铺的店主ID
		long storeUserId = this.baseRestrictionsService.getBaseRestrictionsForCache("xz_jj").getExperience();
		ResponseUser _login_user = null;//登录用户
		if (null != request.getUserId() && request.getUserId() > 0) {
			_login_user = this.userService.selectUserRoleById(request.getUserId());
			if (_login_user != null && org.apache.commons.lang3.StringUtils.isNotEmpty(_login_user.getRecommendFrom())) {
				//登录人对应的店主身份ID
				String recommendFrom = _login_user.getRecommendFrom();
				UserInfo userInfo = this.userService.selectUserInfoByPersionId(recommendFrom);//推荐人身份
				if (userInfo != null) {
					storeUserId = userInfo.getUserId();
				}
			}
		}
		User _store_user = this.userMapper.selectByPrimaryKey(storeUserId);//使用推荐人去计算价格（默认校妆姐姐）

		BrandVoResponse returnBandGoodsPageVo = new BrandVoResponse();//用于封装品牌馆信息和所属商品
		Brand brandVo = brandMapper.selectBrandById(request.getBrandId());
		if (null == brandVo) {
			//			return new ResponseEntity<>(new ResponseBaseModel(ErrorEnum.C20408), HttpStatus.OK);
			return new ResponseEntity<>(new ResponseResultModel<>(null), HttpStatus.OK);
		} else {
			if (null == _login_user) {//未登录
				returnBandGoodsPageVo.setIsEnjoy(0);
			} else {
				int i = brandUserEnjoyMapper.countByUserIdAndBrandId(_login_user.getUserId(), request.getBrandId());
				if (i == 0) {//没有喜欢
					returnBandGoodsPageVo.setIsEnjoy(0);
				} else {
					returnBandGoodsPageVo.setIsEnjoy(1);
				}
			}
			returnBandGoodsPageVo.setId(brandVo.getId());
			returnBandGoodsPageVo.setNameCn(brandVo.getNameCn());
			returnBandGoodsPageVo.setNameEn(brandVo.getNameEn());
			returnBandGoodsPageVo.setLogoPath(brandVo.getLogoPath());
			returnBandGoodsPageVo.setBackgroundImagePath(brandVo.getBackgroundImagePath());
			returnBandGoodsPageVo.setDescriptions(brandVo.getDescriptions());
			returnBandGoodsPageVo.setFirstChar(brandVo.getFirstChar());
			returnBandGoodsPageVo.setBrandName(brandVo.getNameCn());
			returnBandGoodsPageVo.setLikeCount(brandVo.getLikeCount());
		}

		BaseRestrictions baseRestrictions = baseRestrictionsService.getBaseRestrictionsForCache("GOODS_BLACKLIST");
		List<Long> idList = null;
		if (_login_user == null || _login_user.getRoleId() < 3) {
			if (baseRestrictions != null && !StringUtils.isEmpty(baseRestrictions.getName())) {
				String _blacklist_str[] = baseRestrictions.getName().split(",");
				idList = new ArrayList<Long>();
				for (String _id : _blacklist_str) {
					idList.add(Long.valueOf(_id));
				}
			}
		}
		List<GoodSerialVo> gList = goodsMapper.selectGoodsListByBrandIdPage(request.getBrandId(), idList, request.getStartIndex(), request.getPageSize());//查询品牌所属商品
		List<BandGoodsVo> goodList = new ArrayList<BandGoodsVo>();
		if (gList != null && gList.size() > 0) {

			List<Long> goodsIds = new ArrayList<>();
			for (GoodSerialVo gVo : gList) {
				goodsIds.add(gVo.getGoodId());
			}
			Map<Long, GoodsPrice> goodsPriceMap = goodsService.getGoodsViewPriceForGoods(_store_user, goodsIds);//价格
			Map<Long, Long> dynaByGoodsIdMap = inventoryService.findDynaByGoodsId(goodsIds);//库存
			Map<Long, StoreGoods> goodsIdStoreGoodsMap = null;//当前用户上架商品
			if (_login_user == null) {
				goodsIdStoreGoodsMap = new HashMap<>();
			} else {
				goodsIdStoreGoodsMap = storeGoodsService.queryStoreGoods(_login_user.getUserId(), goodsIds);
			}
			for (GoodSerialVo goods : gList) {
				BandGoodsVo bVo = new BandGoodsVo();
				bVo.setGoodsId(goods.getGoodId());
				bVo.setName(goods.getName());
				bVo.setLabelName(goods.getLabelName());
				bVo.setSelfSupport(goods.getSelfSupport());
				bVo.setInventoryAvlNum(goods.getInventoryNum());
				bVo.setNavigateImage(goods.getNavigateImage());
				bVo.setOrderNo(goods.getOrderNo());
				if (goodsIdStoreGoodsMap.get(goods.getGoodId()) == null || goodsIdStoreGoodsMap.get(goods.getGoodId()).getIsDelete() == 1) {
					bVo.setUpOrDown(0);
				} else {
					bVo.setUpOrDown(1);
				}
				if (dynaByGoodsIdMap.containsKey(goods.getGoodId())) {
					if (null != dynaByGoodsIdMap.get(goods.getGoodId())) {
						bVo.setInventoryAvlNum(dynaByGoodsIdMap.get(goods.getGoodId()));
					} else {
						bVo.setInventoryAvlNum(0);
					}
				} else {
					bVo.setInventoryAvlNum(0);
				}
				GoodsPrice price = null;
				if (goodsPriceMap.containsKey(goods.getGoodId())) {
					price = goodsPriceMap.get(goods.getGoodId());
					if (price != null) {
						bVo.setLowestPrice(price.getSalePrice());
						bVo.setMarketPirce(price.getMarketPirce());
						bVo.setCommission(price.getCommission());
					} else {
						bVo.setInventoryAvlNum(0);
					}
				} else {
					bVo.setInventoryAvlNum(0);
				}
				String nowTime = DateUtil.currentStringDate();
				List<ProductTag> ptList = new ArrayList<ProductTag>();//商品标签
				Map<String, Object> ltsMap = null;
				if (null != price) {//分时抢购
					ltsMap = this.goodsMapper.selectNearlyLimitTimeSale(goods.getGoodId(), price.getProductId(), nowTime);
				}
				if (ltsMap != null) {
					ProductTag p = new ProductTag();
					p.setColor("#ff4b7a");
					try {
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
						// 活动开始时间
						Date fullBeginTime = sdf.parse(ltsMap.get("fullBeginTime").toString());
						// 系统当前时间
						long nowTimeMillis = System.currentTimeMillis();
						if (fullBeginTime.getTime() > nowTimeMillis) {// 预热中
							p.setLabel("预热");
						} else {// 抢购中
							p.setLabel("特卖");
						}
					} catch (Exception e) {

					}
					ptList.add(p);
				}
				//				else if(goods.getSelfSupport() == 1) {
				//					pT.setLabel("非自营");
				//				}
				bVo.setProductTags(ptList);
				goodList.add(bVo);
			}
		}
		returnBandGoodsPageVo.setGoodsVoList(goodList);
		//		returnBandGoodsPageVo.setGoodCount(this.countGoodsPageByBrandId(request.getBrandId()));
		returnBandGoodsPageVo.setGoodCount(goodsMapper.selectGoodsIdListByBrandId(request.getBrandId()).size());
		//		if (request.getPageNum() <= 1) {//第一页返回品牌信息
		//			Brand brand = brandMapper.selectBrandById(request.getBrandId());
		//			if (brand != null) {
		//				returnBandGoodsPageVo.setId(brand.getId());
		//				returnBandGoodsPageVo.setNameCn(brand.getNameCn());
		//				returnBandGoodsPageVo.setNameEn(brand.getNameEn());
		//				returnBandGoodsPageVo.setLogoPath(brand.getLogoPath());
		//				returnBandGoodsPageVo.setBackgroundImagePath(brand.getBackgroundImagePath());
		//				returnBandGoodsPageVo.setDescriptions(brand.getDescriptions());
		//				returnBandGoodsPageVo.setFirstChar(brand.getFirstChar());
		//				returnBandGoodsPageVo.setBrandName(brand.getNameCn());
		//				returnBandGoodsPageVo.setLikeCount(brand.getLikeCount());
		//			}
		//		}
		return new ResponseEntity<>(new ResponseResultModel<>(returnBandGoodsPageVo), HttpStatus.OK);
	}

	// 查询商品对应的素材信息<分页>
	@Override
	public List<Map<String, Object>> selectMaterialsByGoodsIdWithPage(long goodsId, int page, Integer pageSize) {
		List<Map<String, Object>> materialsDetails = new ArrayList<Map<String, Object>>();
		List<Map<String, Object>> materialsList = this.goodsMapper.selectMaterialsByGoodsIdWithPage(goodsId, page, pageSize);
		if (!CollectionUtils.isEmpty(materialsList)) {// 有素材信息
			for (Map<String, Object> m : materialsList) {
				Map<String, Object> detail = new HashMap<String, Object>();
				detail.put("id", m.get("id").toString());
				detail.put("title", m.get("context").toString().replaceAll("<[^>]+>", ""));
				detail.put("images", this.goodsMapper.selectTitleDiscoverPicturesByTitleId(Integer.parseInt(m.get("id").toString())));
				materialsDetails.add(detail);
			}
		}
		return materialsDetails;
	}

	/**
	 * 商品详情页预览
	 */
	@Override
	public GoodsVo goodsInfoPreview(long goodsId, Integer storeUserId) {
		Goods goods = this.goodsMapper.selectGoodsByIdTwo(goodsId);
		if (goods == null) {
			return null;
		}
		// 商品不为空，开始给商品的更多属性赋值
		GoodsVo vo = new GoodsVo(goods);
		Brand brand = this.brandMapper.selectBrandById(goods.getBrandId());
		// 品牌为空返回更多品牌
		if (brand == null) {
			brand = this.brandMapper.selectBrandById(85);
		}
		vo.setBrand(brand);
		vo.setLowestPrice(0);
		// 商品介绍图
		List<GoodsNavigate> goodsNavigateList = goodsNavigateMapper.selectGoodsNavigateByGoodId(goodsId);
		vo.setGoodNavigateList(goodsNavigateList);
		// 微信小图
		if (goodsNavigateList != null && goodsNavigateList.size() > 0) {
			vo.setWxSmallImgpath(goodsNavigateList.get(0).getNavigateImage());
		} else {
			vo.setWxSmallImgpath("");
		}
		// 详情图
		List<GoodsDetail> goodsDetailList = goodsDetailMapper.selectGoodsDetailByGoodId(vo.getId(), GoodsImgType.ALL.getType());
		List<GoodsDetail> detailsList = new ArrayList<GoodsDetail>();
		List<GoodsDetail> specList = new ArrayList<GoodsDetail>();
		List<GoodsDetail> noticesList = new ArrayList<GoodsDetail>();
		for (GoodsDetail goodsDetail : goodsDetailList) {
			//详情
			if (goodsDetail.getImgType() == GoodsImgType.DETAIL.getType()) {
				detailsList.add(goodsDetail);
			} else if (goodsDetail.getImgType() == GoodsImgType.SPEC.getType()) {
				specList.add(goodsDetail);
			} else if (goodsDetail.getImgType() == GoodsImgType.NOTICE.getType()) {
				noticesList.add(goodsDetail);
			}
		}
		vo.setGoodDetailList(detailsList);
		vo.setGoodSpecImgList(specList);
		vo.setGoodsNoticeImgList(noticesList);
		// 商品服务项目
		vo.setGoodsServiceList(settingGoodsServiceList(goods));
		List<SpecDesc> specDescList = JSON.parseArray(goods.getSpecDesc(), SpecDesc.class);
		vo.setSpecDescList(specDescList);
		vo.setGoodsCommission(null);
		// 商品推荐数
		vo.setRecommendNum(shareGoodsMapper.selectShareGoodByGoodIdCount(vo.getId()));
		// 商品评论数
		vo.setCommentNum(goodsCommentMapper.selectGoodsCommentByGoodIdCount(vo.getId()));
		// 分享商品可增加的颜值数字
		vo.setShareYanzhi(baseRestrictionsMapper.selectExperienceForShareGoods());
		User user = this.userMapper.selectByPrimaryKey(Long.valueOf(storeUserId));
		GoodsPrice goodsPrice = this.getGoodsViewPriceForGoods(user, vo.getId());
		//商品标签
		List<Map<String, String>> labelArray = new ArrayList<Map<String, String>>();
		String saleStatus = "NormalSale";// 默认原价销售状态
		// 实时库存
		Long realTimeInventory = this.inventoryService.findDynaByGoodsId(goods.getId());
		// 下架了
		if (vo.getOnlineTime() == null || vo.getOfflineTime() == null || (DateUtil.betweenTime(vo.getOnlineTime(), vo.getOfflineTime()) < 1)) {
			saleStatus = "UnderCarriage";
		}
		// C区商品  设置为已下架状态
		if (goods.getGoodsType() == 0) {
			saleStatus = "UnderCarriage";
		}
		vo.setSaleStatus(saleStatus);// 销售状态
		vo.setGoodsPrice(goodsPrice);// 价格信息
		vo.setInventoryNum(realTimeInventory.intValue());// 库存数
		vo.setSalerNums(vo.getUpCount());//在售人数
		vo.setLtsMap(null);// 分时抢购信息
		vo.setLabelArray(labelArray);// 标签信息
		// 活动信息
		/***
		 * 调用公告接口获取活动信息
		 */
		List<Map<String, Object>> activitiesList = new ArrayList<Map<String, Object>>();
		OActivitiesInfo oActivitiesInfo = this.oActivService.getOActivitiesInfo(goodsId, 0L);
		if (oActivitiesInfo != null) {
			if (!CollectionUtils.isEmpty(oActivitiesInfo.getoActivContentExpressList())) {
				for (OActivContentExpress oace : oActivitiesInfo.getoActivContentExpressList()) {
					Map<String, Object> oaMap = new HashMap<String, Object>();
					oaMap.put("tag", oace.getTagName());
					oaMap.put("slogan", oace.getActivTitle());
					oaMap.put("type", 1);
					oaMap.put("number", 1);
					activitiesList.add(oaMap);
				}
			}
			if (!CollectionUtils.isEmpty(oActivitiesInfo.getoActivContentMoneyList())) {
				Map<String, Object> oaMap = new HashMap<String, Object>();
				String oacmTage = "";
				String oacmSlogan = "";
				for (OActivContentMoney oacm : oActivitiesInfo.getoActivContentMoneyList()) {
					if (StringUtils.isEmpty(oacmTage)) {
						oacmTage = oacm.getTagName();
					}
					oacmSlogan = oacmSlogan + oacm.getActivTitle() + ";";
				}
				oaMap.put("tag", oacmTage);
				oaMap.put("slogan", oacmSlogan);
				oaMap.put("type", 0);
				oaMap.put("number", 1);
				activitiesList.add(oaMap);
			}
			if (!CollectionUtils.isEmpty(oActivitiesInfo.getoActivGiftProductList())) {
				for (OActivGiftProduct oagf : oActivitiesInfo.getoActivGiftProductList()) {
					Map<String, Object> oaMap = new HashMap<String, Object>();
					oaMap.put("tag", oagf.getTagName());
					oaMap.put("slogan", oagf.getActivTitle());
					oaMap.put("type", 2);
					oaMap.put("number", oagf.getGiftNum());
					activitiesList.add(oaMap);
				}
			}
		}
		vo.setActivities(activitiesList);
		/** 素材信息 */
		Map<String, Object> materials = new HashMap<String, Object>();
		List<Map<String, Object>> materialsList = this.goodsMapper.selectMaterialsByGoodsId(goodsId);
		int count = 0;
		Map<String, Object> detail = new HashMap<String, Object>();
		if (CollectionUtils.isEmpty(materialsList)) {
			detail.put("title", "");
			detail.put("images", new ArrayList<Map<String, Object>>());
		} else {
			count = materialsList.size();
			detail.put("title", materialsList.get(0).get("context").toString().replaceAll("<[^>]+>", ""));
			detail.put("images", this.goodsMapper.selectTitleDiscoverPicturesByTitleId(Integer.parseInt(materialsList.get(0).get("id").toString())));
		}
		materials.put("count", count);
		materials.put("detail", detail);
		vo.setMaterials(materials);
		return vo;
	}

	/**
	 * 新商品ES搜索
	 */
	@Override
	public List<GoodsListResponse> newGoodsEsSearchGoods(Integer storeUserId, String searchKeyWord, int startIndex, Integer pageSize) throws IOException {
		List<GoodsListResponse> goodsESVoList = new ArrayList<GoodsListResponse>();
		List<String> jsonStrList = ESUtil.searchGoods(ESConstant.ES_INDEX, ESConstant.ES_TYPE_GOODS_B, startIndex, pageSize, searchKeyWord);
		if (jsonStrList != null && jsonStrList.size() > 0) {
			User user = this.userMapper.selectByPrimaryKey(Long.valueOf(storeUserId));
			List<Long> goodsIds = new ArrayList<Long>();
			for (String json : jsonStrList) {
				JSONObject jsonObject = JSONObject.parseObject(json);
				if (jsonObject != null) {
					goodsIds.add(jsonObject.getLongValue("id"));
				}
			}
			// 商品集合
			//List<Goods> goodsList = this.goodsMapper.selectGoodsByIds(goodsIds);
			// 价格信息集合
			Map<Long, GoodsPrice> goodsPriceMap = this.goodsService.getGoodsViewPriceForGoods(user, goodsIds);
			// 库存信息结合
			Map<Long, Long> inventoryMap = this.inventoryService.findDynaByGoodsId(goodsIds);
			// 是否上下架
			Map<Long, StoreGoods> storeGoodsMap = this.storeGoodsService.queryStoreGoods(Long.valueOf(storeUserId), goodsIds);
			//			for (Goods goods : goodsList) {
			for (String js : jsonStrList) {
				JSONObject jsonObject = JSONObject.parseObject(js);
				Long _goods_id = jsonObject.getLongValue("id");
				Goods goods = goodsMapper.selectGoodsById(_goods_id);

				GoodsListResponse goodsListResponse = new GoodsListResponse();
				goodsListResponse.setGoodId(goods.getId());
				goodsListResponse.setLabelName(goods.getLabelName());
				goodsListResponse.setGoodsName(goods.getName());
				goodsListResponse.setName(goods.getName());
				goodsListResponse.setSuggestedPrice(goods.getSuggestedPrice());
				/*if (!StringUtils.isEmpty(goods.getGoodsWidthPic())) {
					goodsListResponse.setGoodNavigateImage(goods.getGoodsWidthPic());
				} else {*/
				List<GoodsNavigate> goodsNavigateList = this.goodsNavigateMapper.selectGoodsNavigateByGoodId(goods.getId());
				if (!CollectionUtils.isEmpty(goodsNavigateList)) {
					goodsListResponse.setGoodNavigateImage(goodsNavigateList.get(0).getNavigateImage());
				}
				/*}*/
				goodsListResponse.setBrandName("");
				goodsListResponse.setSelfSupport(goods.getSelfSupport());
				//价格信息
				GoodsPrice goodsPrice = goodsPriceMap.get(goods.getId()) == null ? this.goodsService.getGoodsViewPriceForGoods(user, goods.getId()) : goodsPriceMap.get(goods.getId());
				//当价格信息获取不到的时候，跳过显示
				if(goodsPrice == null) {
					continue;
				}
				//商品标签
				List<Map<String, String>> labelArray = new ArrayList<Map<String, String>>();
				String nowTime = DateUtil.currentStringDate();
				String saleStatus = "NormalSale";// 默认原价销售状态
				Long productId = goodsPrice.getProductId();
				// 查询是否存在分时抢购活动
				Map<String, Object> ltsMap = this.goodsMapper.selectNearlyLimitTimeSale(goods.getId(), productId, nowTime);
				if (ltsMap != null) {
					Map<String, String> tmLabel = new HashMap<String, String>();
					// 分时抢购开始时间
					try {
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
						// 活动开始时间
						Date fullBeginTime = sdf.parse(ltsMap.get("fullBeginTime").toString());
						// 系统当前时间
						long nowTimeMillis = System.currentTimeMillis();
						if (fullBeginTime.getTime() > nowTimeMillis) {// 预热中
							saleStatus = "PreHeat";
							tmLabel.put("label", "预热");
						} else {// 抢购中
							saleStatus = "SecKill";
							tmLabel.put("label", "特卖");
						}
					} catch (ParseException e) {

					}
					tmLabel.put("color", "#ff4b7a");
					labelArray.add(tmLabel);
				}
				// 实时库存
				long realTimeInventory = inventoryMap.get(goods.getId()) == null ? this.inventoryService.findDynaByGoodsId(goods.getId()) : inventoryMap.get(goods.getId());
				// 下架了
				if (goods.getOnlineTime() == null || goods.getOfflineTime() == null || (DateUtil.betweenTime(goods.getOnlineTime(), goods.getOfflineTime()) < 1)) {
					saleStatus = "UnderCarriage";
				}
				// C区商品  设置为已下架状态
				if (goods.getGoodsType() == 0) {
					saleStatus = "UnderCarriage";
				}
				if (storeGoodsMap.get(goods.getId()) == null) {
					goodsListResponse.setUpOrDown(0);
				} else {
					goodsListResponse.setUpOrDown(1);
				}

				goodsListResponse.setSaleStatus(saleStatus);// 销售状态
				goodsListResponse.setGoodsPrice(goodsPrice);// 价格信息
				goodsListResponse.setInventoryNum(realTimeInventory);// 库存数
				goodsListResponse.setSalerNums(goods.getUpCount());
				goodsListResponse.setLabelArray(labelArray);// 标签信息
				goodsESVoList.add(goodsListResponse);
			}
		}
		return goodsESVoList;
	}

	/**
	 * 统计商品搜索词汇
	 */
	@Override
	public void statisticsGoodsSearchWords(String searchKeyWord) {
		try {
			// 添加或更新搜索词汇
			List<GoodsSearchWord> searchWords = this.goodsSearchWordMapper.selectGoodsSearchWordBySearchWord(searchKeyWord);
			if (searchWords != null && searchWords.size() > 0) {
				this.goodsSearchWordMapper.updateGoodsSearchWordNumBySearchWord(searchKeyWord);
			} else {
				this.goodsSearchWordMapper.insertGoodsSearchWord(searchKeyWord);
			}
		} catch (Exception e) {
			// 异常不处理
		}
	}

	@Override
	public Goods getGoodsUpDownCount(Goods goods) {
		String upCount = redisUtil.hmget(RedisKey.REDIS_KEY_PREFIX_MODE + RedisKey.REDIS_KEY_GOODS_FIELD_INFO + goods.getId(), "up_count");
		String downCount = redisUtil.hmget(RedisKey.REDIS_KEY_PREFIX_MODE + RedisKey.REDIS_KEY_GOODS_FIELD_INFO + goods.getId(), "down_count");
		if (org.apache.commons.lang3.StringUtils.isBlank(upCount) || org.apache.commons.lang3.StringUtils.isBlank(downCount)) {
			/**
			 *
			 */
			if (goods.getUpCount() > 0 || goods.getDownCount() > 0) {
				redisUtil.hmset(RedisKey.REDIS_KEY_PREFIX_MODE + RedisKey.REDIS_KEY_GOODS_FIELD_INFO + goods.getId(), "up_count", goods.getUpCount() + "");
				redisUtil.hmset(RedisKey.REDIS_KEY_PREFIX_MODE + RedisKey.REDIS_KEY_GOODS_FIELD_INFO + goods.getId(), "down_count", goods.getDownCount() + "");
			} else {
				Goods result = goodsMapper.selectGoodsByIdForAll(goods.getId());
				goods.setUpCount(result.getUpCount());
				goods.setDownCount(result.getDownCount());
				redisUtil.hmset(RedisKey.REDIS_KEY_PREFIX_MODE + RedisKey.REDIS_KEY_GOODS_FIELD_INFO + goods.getId(), "up_count", result.getUpCount() + "");
				redisUtil.hmset(RedisKey.REDIS_KEY_PREFIX_MODE + RedisKey.REDIS_KEY_GOODS_FIELD_INFO + goods.getId(), "down_count", result.getDownCount() + "");
			}
		} else {
			goods.setUpCount(Integer.valueOf(upCount));
			goods.setDownCount(Integer.valueOf(downCount));
		}
		return goods;
	}

	/**
	 * <dl>
	 * <dt>根据商品id确定商品的额外属性</dt>
	 * </dl>
	 * 
	 * @param Goods
	 * @returnGoodsExtends
	 * @author gaoweiqi
	 * @date 2018年4月16日 12:44:05
	 */
	private GoodsExtends LoadGoodsExtends(Goods goods) {
		GoodsExtends goodsExtends = null;
		if (goods.getHasExtends() == 1) {// 有额外属性
			goodsExtends = goodsExtendedAttributeMapper.selectExtendsAttrByGoodsID(goods.getId());
			if (goodsExtends == null) {
				logger.error("该产品没有维护扩展属性: goodsID:{}", goods.getId());
				goodsExtends = new GoodsExtends(goods.getId(), 0, 0, 0, 0, 0, 1, 0);
			}
		} else {// 否则取渠道店铺的属性作为商品属性
			Store store = storeMapper.getStoreByGoodsID(goods.getId());
			goodsExtends = new GoodsExtends();
			goodsExtends.setRefund(store.getRefund());
			goodsExtends.setPromotion(store.getPromotion());
			goodsExtends.setInvoice(store.getInvoice());
			goodsExtends.setOverseasGoods(store.getOverseasGoods());
			goodsExtends.setCommision(1);
			goodsExtends.setGiftPacks(1);
			goodsExtends.setGoodsId(goods.getId());
		}
		return goodsExtends;
	}
}
